build.xml
2.62 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
<!--
- A sample build.xml that can be saved in WEB-INF/build.xml and run with
- ant -f WEB-INF/build.xml
-->
<project name="application" default="help" basedir=".">
<property file="local.properties"/>
<!-- assume build.xml is in webapps/APPNAME/WEB-INF for finding resin.home -->
<property name="resin.home" location="${basedir}/../../.."/>
<property name="resin.root" location="${resin.home}"/>
<property name="webApp.root" location="${basedir}/.."/>
<property name="webApp.lib" location="${webApp.root}/WEB-INF/lib"/>
<property name="webApp.src" location="${webApp.root}/WEB-INF/classes"/>
<property name="webApp.classes" location="${webApp.root}/WEB-INF/classes"/>
<property name="webApp.work" location="${webApp.root}/WEB-INF/work"/>
<property name="war" location="${java.io.tmpdir}/${ant.project.name}.war"/>
<path id="classpath">
<fileset dir="${resin.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${webApp.lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${java.home}/../lib/tools.jar"/>
</path>
<target name="help">
<echo>
A sample build.xml that can be saved in WEB-INF/build.xml and run with
ant -f WEB-INF/build.xml all
Most developers using Resin do not use a build script because Resin will
compile all changed files automatically. However precompilation of all
files is sometimes desired before deploying an application in production.
TARGETS:
compile all compilation
classes compile classes in WEB-INF/classes
jsp pre-compile all jsp files
war build a war file in ${war}
clean delete the .class and compiled jsp files
</echo>
</target>
<target name="compile" depends="classes, jsp"/>
<target name="classes">
<mkdir dir="${webApp.classes}"/>
<javac srcdir="${webApp.src}"
destdir="${webApp.classes}"
classpathref="classpath"
fork="true"
/>
</target>
<target name="jsp">
<mkdir dir="${webApp.work}"/>
<java classname="com.caucho.jsp.JspCompiler"
classpathref="classpath" fork="true">
<arg value="-app-dir"/>
<arg path="${webApp.root}"/>
<arg value="-class-dir"/>
<arg path="${webApp.work}"/>
<arg path="${webApp.root}"/>
</java>
</target>
<target name="war" depends="compile">
<delete file="${war}"/>
<jar destfile="${war}"
basedir="${webApp.root}"/>
</target>
<target name="clean">
<delete dir="${webApp.root}/WEB-INF/work"/>
<delete>
<fileset dir="${webApp.classes}" includes="**/*.class"/>
</delete>
</target>
</project>