forked from skeeto/sample-java-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
189 lines (170 loc) · 6.64 KB
/
build.xml
File metadata and controls
189 lines (170 loc) · 6.64 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0"?>
<project name="SampleLwjglProject" default="jar"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Project-specific configuration -->
<loadproperties srcfile="project.properties"/>
<property name="main.class" value="${package.main}.${ant.project.name}"/>
<property name="base.name" value="${artifactId}-${version}"/>
<!-- Standard Directory Layout -->
<property name="src.dir" value="src"/>
<property name="test.dir" value="test"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<!-- Targets -->
<target name="resolve" description="Retrieve dependencies with Ivy.">
<ivy:resolve log="quiet"/>
<ivy:cachepath conf="build" pathid="build.classpath"/>
<ivy:cachepath conf="default" pathid="runtime.classpath"/>
<ivy:cachefileset conf="default" setid="runtime.fileset"/>
<ivy:cachepath conf="test" pathid="test.classpath"/>
</target>
<target name="compile" depends="resolve" description="Compile all sources.">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}" destdir="${build.dir}/classes"
optimize="on" debug="on" deprecation="on" includeantruntime="no">
<compilerarg value="-Xlint"/>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${build.dir}/classes">
<fileset dir="${src.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="jar" depends="compile"
description="Generate the jarfile distributable.">
<jar destfile="${dist.dir}/${base.name}.jar"
basedir="${build.dir}/classes">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<jar destfile="${dist.dir}/${base.name}-all.jar"
basedir="${build.dir}/classes">
<zipgroupfileset refid="runtime.fileset"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="compile" description="Run the application.">
<java classname="${main.class}" classpath="${build.dir}/classes">
<classpath refid="build.classpath"/>
<arg value="--name"/>
<arg value="Java"/>
</java>
</target>
<target name="run-hotswap" depends="compile"
description="Run the application in hotswap mode.">
<java classname="${main.class}" classpath="${build.dir}/classes"
fork="true">
<classpath refid="build.classpath"/>
<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,address=9000,server=y,suspend=n"/>
<arg value="--loop"/>
<arg value="--name"/>
<arg value="Java"/>
</java>
</target>
<target name="hotswap" depends="compile">
<taskdef name="hotswap" classname="dak.ant.taskdefs.Hotswap"/>
<hotswap verbose="true" port="9000">
<fileset dir="${build.dir}/classes" includes="**/*.class">
<modified/>
</fileset>
</hotswap>
</target>
<target name="clean" description="Delete all generated files.">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${lib.dir}"/>
<delete file="cache.properties"/>
</target>
<target name="javadoc" depends="resolve,compile"
description="Generate documentation.">
<taskdef classname="lombok.delombok.ant.DelombokTask" name="delombok"
classpathref="build.classpath"/>
<delombok verbose="true" to="${build.dir}/src" from="${src.dir}">
<classpath refid="build.classpath"/>
</delombok>
<javadoc destdir="${dist.dir}/javadoc"
link="http://download.oracle.com/javase/6/docs/api/"
sourcepath="${build.dir}/src"
Doctitle="${ant.project.name} ${version}"
Windowtitle="${ant.project.name} ${version}">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<target name="format" description="Run the indenter on all source files.">
<apply executable="astyle">
<arg value="--mode=java"/>
<arg value="--suffix=none"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
<fileset dir="${test.dir}" includes="**/*.java"/>
</apply>
</target>
<target name="check" depends="resolve">
<taskdef resource="checkstyletask.properties"
classpathref="build.classpath"/>
<checkstyle config="checkstyle.xml">
<fileset dir="${src.dir}" includes="**/*.java"/>
<classpath path="${build.dir}/classes"/>
</checkstyle>
</target>
<target name="tags" description="Generate a TAGS file for your editor.">
<delete file="TAGS"/>
<apply executable="etags">
<arg value="-a"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
<fileset dir="${test.dir}" includes="**/*.java"/>
</apply>
</target>
<!-- Unit testing (JUnit) -->
<target name="test-compile" depends="compile">
<mkdir dir="${build.dir}/test"/>
<javac srcdir="${test.dir}" destdir="${build.dir}/test"
optimize="on" debug="on" deprecation="on"
classpath="${build.dir}/classes" includeantruntime="no">
<compilerarg value="-Xlint"/>
<classpath refid="build.classpath"/>
<classpath refid="test.classpath"/>
</javac>
<copy todir="${build.dir}/test">
<fileset dir="${test.dir}" excludes="**/*.java"/>
</copy>
</target>
<target name="test" depends="test-compile" description="Run the unit tests.">
<junit fork="yes">
<classpath>
<pathelement path="${build.dir}/classes"/>
<pathelement path="${build.dir}/test"/>
<path refid="test.classpath"/>
</classpath>
<batchtest>
<formatter type="brief" usefile="false"/>
<fileset dir="${build.dir}/test"/>
</batchtest>
</junit>
</target>
<!-- Maven repository support -->
<target name="bundle" depends="jar,javadoc"
description="Stage a Maven repository bundle.">
<!-- Pack up the artifacts -->
<filter filtersfile="project.properties"/>
<filter token="ant.project.name" value="${ant.project.name}"/>
<copy file="pom.xml" filtering="true"
tofile="${dist.dir}/bundle/${base.name}.pom"/>
<copy file="${dist.dir}/${base.name}.jar" todir="${dist.dir}/bundle/"/>
<jar jarfile="${dist.dir}/bundle/${base.name}-javadoc.jar">
<fileset dir="${dist.dir}/javadoc"/>
</jar>
<jar jarfile="${dist.dir}/bundle/${base.name}-sources.jar">
<fileset dir="${src.dir}"/>
</jar>
<!-- Sign all the things. You'll need gpg-agent help here. -->
<apply executable="gpg">
<arg value="--detach-sign"/>
<arg value="--armor"/>
<fileset dir="${dist.dir}/bundle"/>
</apply>
<!-- Pack it all up -->
<jar destfile="${dist.dir}/bundle.jar" basedir="${dist.dir}/bundle"/>
</target>
</project>