My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
<!--
Ant Sprint Template Project
By: Justin Miller (justinrmiller@gmail.com)
-->

<project name="SpringTemplate" default="dist" basedir=".">
<description>
Sprint Template Project
</description>

<!-- Global Properties -->
<property name="build.dir" location="build"/>
<property name="dist.dir" location="dist"/>
<property name="dist.lib.dir" location="dist/lib"/>
<property name="lib.dir" location="lib"/>
<property name="src.dir" location="src"/>
<property name="test.dir" location="test"/>
<property name="test.classes.dir" location="testclasses"/>
<property name="test.report.dir" location="testreport"/>
<property name="manifest.main-class" value="com.justinrmiller.springtemplate.Main"/>

<!-- JARs -->
<path id="compile.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>

<target name="compile.java">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="compile.classpath"/>
</target>

<target name="compile.test" depends="compile.java">
<mkdir dir="${test.classes.dir}"/>
<javac srcdir="${test.dir}" destdir="${test.classes.dir}">
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${build.dir}"/>
</classpath>
</javac>
</target>

<target name="compile" depends="compile.java, compile.test"/>

<target name="dist" depends="compile" description="" >
<!-- Convert project class path to string property -->
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="compile.classpath" />
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="lib/*" casesensitive="no"/>
</chainedmapper>
</mapper>
</pathconvert>

<!-- Create dist and dependant lib directory -->
<mkdir dir="${dist.dir}/"/>
<mkdir dir="${dist.lib.dir}/"/>

<!-- Copy config files to build dir -->
<copy todir="${build.dir}/">
<fileset dir="${src.dir}/">
<include name="spring-config.xml"/>
</fileset>
</copy>

<!-- Put everything in ${build.dir} into the ${ant.project.name}.jar file -->
<jar jarfile="${dist.dir}/${ant.project.name}.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${manifest.main-class}"/>
<attribute name="Class-Path" value="${manifest.classpath}"/>
</manifest>
</jar>

<!-- Copy in the JAR dependencies -->
<copy todir="${dist.lib.dir}">
<fileset dir="${lib.dir}"/>
</copy>
</target>

<target name="clean" description="Clean the project" >
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${test.classes.dir}"/>
<delete dir="${test.report.dir}"/>
</target>

<target name="test" description="Run unit tests for the project">
<mkdir dir="${test.report.dir}"/>
<property name="tests" value = "*Test" />
<junit fork="yes" printsummary="yes" haltonerror="yes" haltonfailure="yes">
<formatter type="plain" usefile="false" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.dir}">
<include name="**/${tests}.java"/>
<exclude name="**/Test*All.java"/>
</fileset>
</batchtest>
<classpath>
<path refid="compile.classpath"/>
<pathelement location="${src.dir}"/>
<pathelement location="${test.dir}"/>
<pathelement location="${build.dir}"/>
<pathelement location="${test.classes.dir}"/>
</classpath>
</junit>
</target>
</project>

Change log

r46 by justinrmiller on Sep 7, 2011   Diff
Cleaning up the build.xml file's
formatting.
Go to: 
Project members, sign in to write a code review

Older revisions

r41 by justinrmiller on Aug 16, 2011   Diff
Checking in initial Spring-based
project template.
All revisions of this file

File info

Size: 3426 bytes, 110 lines
Powered by Google Project Hosting