-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
143 lines (93 loc) · 3.93 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?xml version="1.0"?>
<!-- ======================================================================
Date: January 2010
Project: Struts 2 Hello World
Author: Bruce Phillips
====================================================================== -->
<project name="StrutsBlag" default="archive" basedir=".">
<description>
Basic Struts 2 Java Web Application
</description>
<property file="build.properties"/>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="clean" description="Delete old build and dist directories">
<delete dir="${dist.home}"/>
<delete dir="${build.home}"/>
</target>
<!-- ==================== Init Target ================================== -->
<!--
The "init" target is used to create the "build" destination directory,
Normally, this task is executed indirectly when needed.
-->
<target name="init" depends="clean" description="Create build directory">
<mkdir dir="${build.home}" />
</target>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into class files in the appropriate location in the build directory.
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes".
-->
<target name="compile" depends="init" description="Compile Java sources">
<mkdir dir="${build.home}/WEB-INF/classes" />
<javac srcdir="${source.home}"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}"
includeantruntime="false"
source="1.6" target="1.6">
<classpath>
<path>
<fileset dir="${lib.home}" />
<fileset dir="${lib.external}" />
</path>
</classpath>
</javac>
</target>
<!-- ==================== Build Target ================================== -->
<!--
The "build" target copies all non class files to build directory
-->
<target name="build" depends="compile" description="Copies all non Java classes to build directoy">
<copy todir="${build.home}">
<fileset dir="${webapp.home}" excludes="SVN,**/*.class" />
</copy>
<copy todir="${build.home}/WEB-INF/classes">
<fileset dir="${source.home}" excludes="SVN,**/*.java" />
</copy>
</target>
<!-- ==================== Archive Target ================================== -->
<!--
The "archive" target create a binary archive of all files in build.home
-->
<target name="archive" depends="build" description="Create binary archive of all files in dist.home">
<mkdir dir="${dist.home}" />
<!-- Create application WAR file -->
<jar jarfile="${dist.home}/${app.name}.war"
basedir="${build.home}" >
</jar>
</target>
<target name="test" depends="build">
<mkdir dir="${dist.home}" />
<manifestclasspath property="jar.classpath" jarfile="dist/${app.name}.jar">
<classpath>
<path>
<fileset dir="${lib.home}" />
</path>
</classpath>
</manifestclasspath>
<jar destfile="dist/${app.name}.jar"
basedir="build/WEB-INF/classes">
<manifest>
<attribute name="Main-Class" value="com.company.util.BlogManager"/>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
</target>
</project>