-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
60 lines (51 loc) · 2.19 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
<?xml version="1.0" encoding="UTF-8" ?>
<project name="ThinkAboutJava" default="clear" basedir=".">
<description>This is a simple ant-build file</description>
<!-- set global properties for this build -->
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="lib" value="./WebContent/WEB-INF/lib"/>
<!-- set dependencies-->
<path id="library.dir">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="information" description="print the build-in properties and environment settings">
<echo message="${basedir}"/>
<echo message="${ant.version}"/>
<echo message="${ant.file}"/>
<echo message="${ant.project.name}"/>
<echo message="${ant.java.version}"/>
<echo message="${os.name}"/>
<!-- <property environment="env" />-->
<!-- <echo message="${env.PATH}"></echo>-->
</target>
<target name="init" description="initialize the project">
<!-- create the time stamp -->
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source">
<!-- compile the Java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<classpath refid="library.dir"/>
</javac>
</target>
<target name="buildToJar" depends="compile" description="generate the distribution">
<!-- create the distribution directory -->
<mkdir dir="${dist}"/>
<!-- put everything in ${build} into the ThinkAboutJava-${DSTAMP}.jar file -->
<jar jarfile="${dist}/ThinkAboutJava-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="runJar" depends="buildToJar" description="run jar file">
<java classname="test.java.singleton.SingletonTest" classpath="${dist}/ThinkAboutJava-${DSTAMP}.jar"/>
</target>
<target name="clean" description="clean up">
<!-- delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="out"/>
</target>
</project>