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
125 lines (112 loc) · 4.51 KB
/
build.xml
File metadata and controls
125 lines (112 loc) · 4.51 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
<?xml version="1.0"?>
<project name="" default="jar" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Project-specific configuration -->
<property name="artifactId" value=""/>
<property name="description" value=""/>
<property name="version" value="0.1"/>
<property name="package.main" value="com.nullprogram.${artifactId}"/>
<property name="main.class" value="${package.main}.Launcher"/>
<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="download-only"/>
<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"/>
<ivy:cachepath conf="analysis" pathid="analysis.classpath"/>
</target>
<target name="compile" depends="resolve" description="Compile all sources.">
<mkdir dir="${dist.dir}"/>
<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" fork="yes">
<classpath refid="runtime.classpath"/>
</java>
</target>
<target name="clean" description="Delete all generated files.">
<delete dir="${build.dir}"/>
<delete dir="${dist.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="check" depends="resolve" description="Run Checkstyle.">
<taskdef resource="checkstyletask.properties"
classpathref="analysis.classpath"/>
<checkstyle config="checkstyle.xml">
<fileset dir="${src.dir}" includes="**/*.java"/>
<classpath path="${build.dir}/classes"/>
</checkstyle>
</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>
</project>