- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjava-build.xml
More file actions
Latest commit
141 lines (115 loc) · 4.55 KB
/
Copy pathjava-build.xml
File metadata and controls
141 lines (115 loc) · 4.55 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
Sep 24, 2009 7:34:03 PM
java-build
Java build routines for all projects
====================================================================== -->
<projectname="java-build"default="help">
<description>
Common build routines for all java projects
</description>
<!-- Always import the common build file -->
<importfile="common-build.xml" />
<propertyname="src.dir"value="${basedir}/src/main" />
<propertyname="src.java.dir"value="${src.dir}/java" />
<!-- We want to always ensure that the java directory exists -->
<sequential>
<mkdirdir="${src.java.dir}" />
</sequential>
<propertyname="src.config.dir"value="${src.dir}/config" />
<propertyname="build.dir"value="${basedir}/build" />
<propertyname="dist.dir"value="${basedir}/dist" />
<propertyname="doc.dir"value="${build.dir}/doc" />
<propertyname="taglibdoc.dir"value="${doc.dir}/tagdoc" />
<!-- now for the library paths -->
<propertyname="lib.dir"value="${src.dir}/lib" />
<propertyname="util.lib.dir"value="${basedir}/src/util/lib" />
<propertyname="build.classes.dir"value="${build.dir}/classes"/>
<pathid="compile.webapp.classpath">
<pathrefid="compile.classpath" />
</path>
<pathid="compile.classpath">
<filesetdir="${lib.dir}"includes="*.jar"/>
<filesetdir="${test.lib.dir}/"includes="*.jar"/>
<filesetdir="${util.lib.dir}"includes="*.jar"/>
</path>
<filesetdir="${build.classes.dir}"id="jar.fileset.classes">
<includename="**/*.class"/>
<includename="**/*.properties"/>
<includename="**/*.templar"/>
</fileset>
<!-- include all of the extraneous files that are needed -->
<filesetdir="${src.java.dir}"id="jar.fileset.other">
<includename="**/*.xml" />
<includename="**/*.properties" />
</fileset>
<!--
Compile all of the java source code
-->
<targetname="compile"depends="clean,init"description="[java-build] Compile all of the source code">
<echomessage="Compiling with Java classpath" />
<javacsrcdir="${basedir}/src/main/java"destdir="${basedir}/build/classes"debug="on"classpathref="compile.classpath"includeantruntime="false"compiler="javac1.6"source="1.6"target="1.6" />
<copytodir="${basedir}/build/classes">
<filesetdir="${src.java.dir}">
<includename="**/*.properties" />
<includename="**/*.templar" />
</fileset>
</copy>
</target>
<targetname="jar"depends="compile"description="[java-build] Jar the compiled files">
<jardestfile="${dist.dir}/${ant.project.name}.jar">
<!-- include the compiled files -->
<filesetrefid="jar.fileset.classes" />
<filesetrefid="jar.fileset.other" />
</jar>
</target>
<targetname="jar-executable"depends="compile"description="[java-build] Jar the compiled files into an executable artifact.">
<failunless="manifest.file"message="The property $${manifest.file} is required" />
<jardestfile="${dist.dir}/${ant.project.name}.jar"manifest="${manifest.file}">
<!-- include the compiled files -->
<filesetrefid="jar.fileset.classes" />
<filesetrefid="jar.fileset.other" />
</jar>
</target>
<targetname="dist"depends="clean,jar"description="[java-build] Build the distributables" />
<!--
Create the directories that are needed
-->
<targetname="init">
<!-- Create the output directories -->
<mkdirdir="${build.dir}" />
<mkdirdir="${build.classes.dir}" />
<mkdirdir="${dist.dir}" />
<!-- Create the library directories -->
<mkdirdir="${lib.dir}" />
<mkdirdir="${util.lib.dir}" />
<mkdirdir="${test.lib.dir}" />
</target>
<targetname="init-project"description="[java-build] Create a new project" >
<!-- create the src directories -->
<mkdirdir="${src.java.dir}" />
<mkdirdir="${test.java.dir}" />
<!-- create the library directories -->
<mkdirdir="${lib.dir}" />
<mkdirdir="${test.lib.dir}" />
</target>
<!--
Clean up the build and distribution directories
-->
<targetname="clean"description="[java-build] Clean the project by deleting all output directories">
<deletedir="${build.dir}"failonerror="false"/>
<deletedir="${dist.dir}"failonerror="false"/>
</target>
<!--
Create the source distribution
-->
<targetname="dist-src"depends="init"description="[java-build] Create the source distribution">
<zipdestfile="${dist.dir}/${ant.project.name}-src.zip">
<zipfilesetdir=".">
<includename="src/**/*.*" />
<includename="build.xml" />
<includename="LICENCE.txt" />
</zipfileset>
</zip>
</target>
</project>