-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
146 lines (129 loc) · 5.07 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
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
<project name="vraptor-scaffold" default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="build.properties" />
<!-- paths -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
<fileset dir="lib/provided" />
</path>
<path id="test.path.id">
<fileset dir="lib/test" />
<path refid="lib.path.id" />
<pathelement location="${test.build.dir}" />
<pathelement location="${build.dir}" />
</path>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" description="--> retrieve dependencies with ivy">
<path id="ivy.lib.path">
<pathelement location="${ivy.jar.file}" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
<ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" sync="true" />
<delete dir="${lib.dir}" includes="**/*.*" />
<copy todir="${lib.dir}">
<fileset dir="lib/default">
<include name="*.jar" />
</fileset>
</copy>
</target>
<!-- =================================
target: compile
================================= -->
<target name="compile" depends="resolve" description="--> compile">
<mkdir dir="${build.dir}" />
<delete dir="${build.dir}" includes="**/*.*" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" debug="on" />
<copy todir="${build.dir}">
<fileset dir="${resources.dir}">
<include name="**/*.*" />
</fileset>
</copy>
</target>
<!-- =================================
target: compile test
================================= -->
<target name="compile-test" depends="compile" description="--> compile test">
<mkdir dir="${test.build.dir}" />
<delete dir="${test.build.dir}" includes="**/*.*" />
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" classpathref="test.path.id" debug="on" />
<copy todir="${test.build.dir}">
<fileset dir="${test.resources.dir}">
<include name="**/*.*" />
</fileset>
</copy>
</target>
<!-- =================================
target: run tests
================================= -->
<target name="test" depends="compile-test" description="--> run all tests">
<mkdir dir="${output.dir}/test-results" />
<junit haltonfailure="yes">
<batchtest fork="yes" todir="${output.dir}/test-results">
<fileset dir="${test.src.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath refid="test.path.id" />
</junit>
</target>
<!-- =================================
target: war
================================= -->
<target name="war" description="--> generate war file" depends="test">
<war destfile="${output.dir}/${project.name}.war">
<zipfileset dir="${webapp.dir}" />
</war>
</target>
<!-- =================================
target: jetty.run
================================= -->
<target name="jetty.run" description="--> run jetty server" depends="compile">
<path id="jetty.path.id">
<fileset dir="lib/jetty" />
</path>
<taskdef classpathref="jetty.path.id" resource="tasks.properties" loaderref="jetty.loader" />
<jetty tempDirectory="${output.dir}/jetty-temp">
<webApp name="${project.name}" warfile="${webapp.dir}" contextpath="/" scanIntervalSeconds="3">
<scanTargets dir="${build.dir}">
<include name="**/*"/>
</scanTargets>
</webApp>
</jetty>
</target>
<!-- =================================
target: minify
================================= -->
<target name="minify" depends="resolve" description="minify js and css">
<property name="yuicompressor.jar" value="lib/minify/yuicompressor-2.3.6.jar" />
<fileset dir="${js.dir}" includes="*.js" excludes="all.min.js" id="alljs" />
<fileset dir="${css.dir}" includes="*.css" excludes="*.min.css" id="allcss" />
<delete file="${css.dir}/all.css" />
<concat destfile="${css.dir}/all.css" fixlastline="true">
<fileset refid="allcss" />
</concat>
<java jar="${yuicompressor.jar}" fork="true">
<arg value="${css.dir}/all.css" />
<arg value="-o" />
<arg value="${css.dir}/all.min.css" />
</java>
<delete file="${js.dir}/all.js" />
<concat destfile="${js.dir}/all.js" fixlastline="true">
<fileset refid="alljs" />
</concat>
<java jar="${yuicompressor.jar}" fork="true">
<arg value="${js.dir}/all.js" />
<arg value="-o" />
<arg value="${js.dir}/all.min.js" />
</java>
</target>
<!-- =================================
target: report
================================= -->
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<mkdir dir="${output.dir}/reports" />
<ivy:report todir="${output.dir}/reports" />
</target>
</project>