-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
64 lines (55 loc) · 2.38 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="ant_simple_compile" default="all">
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="main.build.dir" value="${build}/main"/>
<property name="main.build.dir.classes" value="${main.build.dir}/classes"/>
<property name="main.src.dir" value="${src}/main/java"/>
<property name="test.build.dir" value="${build}/test"/>
<property name="test.build.dir.classes" value="${test.build.dir}/classes"/>
<property name="test.src.dir" value="${src}/test/java"/>
<property name="main.class" value="com.hello.HelloWorld"/>
<property name="lib" value="lib"/>
<path id="classpath.test">
<pathelement location="${lib}/junit-4.12.jar"/>
<pathelement location="${lib}/hamcrest-core-1.3.jar"/>
<pathelement location="${main.build.dir.classes}"/>
</path>
<target name="compile">
<mkdir dir="${main.build.dir.classes}"/>
<javac srcdir="${main.src.dir}" destdir="${main.build.dir.classes}" includeantruntime="false"/>
</target>
<target name="test-compile" depends="compile">
<mkdir dir="${test.build.dir.classes}"/>
<javac srcdir="${test.src.dir}" destdir="${test.build.dir.classes}" includeantruntime="false">
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="test-compile">
<junit printsummary="on" haltonfailure="yes" fork="true">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${test.build.dir.classes}"/>
</classpath>
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.src.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
<target name="package" depends="test">
<jar destfile="${main.build.dir}/${ant.project.name}.jar" basedir="${main.build.dir.classes}">
<manifest>
<attribute name="Main-Class" value="${main.class}" />
</manifest>
</jar>
</target>
<target name="all" depends="package">
</target>
<target name="run" depends="package">
<java jar="${main.build.dir}/${ant.project.name}.jar" fork="true"/>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
</project>