-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
113 lines (100 loc) · 4.05 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
<project default="install">
<property environment="env"/>
<property file="build.properties"/>
<property file="${app}/tomcat.properties"/>
<property name="appdir" value="${basedir}/${app}"/>
<basename property="appname" file="${appdir}"/>
<property name="builddir" value="${appdir}/build"/>
<property name="warfile" value="${builddir}/${appname}.war"/>
<path id="classpath">
<pathelement location="${jsf.api.jar}"/>
<pathelement location="${servlet.api.jar}"/>
<pathelement location="${el.api.jar}"/>
<pathelement location="${cdi.api.jar}"/>
<pathelement location="${bean-validation.api.jar}"/>
<pathelement location="${jpa.api.jar}"/>
<pathelement location="${jta.api.jar}"/>
<pathelement location="${ejb.api.jar}"/>
<pathelement location="${mail.api.jar}"/>
<fileset dir="${appdir}">
<include name="lib/*.jar"/>
</fileset>
</path>
<target name="init">
<fail unless="app" message="Run ant -Dapp=..."/>
</target>
<target name="prepare" depends="init"
description="Create build directory.">
<delete dir="${builddir}"/>
<mkdir dir="${builddir}"/>
<mkdir dir="${builddir}/WEB-INF"/>
<mkdir dir="${builddir}/WEB-INF/classes"/>
</target>
<target name="copy" depends="prepare"
description="Copy files to build directory.">
<copy todir="${builddir}" failonerror="false" verbose="true">
<fileset dir="${appdir}/web"/>
</copy>
<copy todir="${builddir}/WEB-INF/classes"
failonerror="false" verbose="true">
<fileset dir="${appdir}/src/java">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy todir="${builddir}/WEB-INF" failonerror="false" verbose="true">
<fileset dir="${appdir}">
<include name="lib/**"/>
</fileset>
</copy>
</target>
<target name="compile" depends="copy"
description="Compile source files.">
<javac
srcdir="${appdir}/src/java"
destdir="${builddir}/WEB-INF/classes"
debug="true"
deprecation="true">
<compilerarg value="-Xlint:unchecked"/>
<include name="**/*.java"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="jsf-libs" if="use-jsf-libs" unless="glassfish">
<mkdir dir="${builddir}/WEB-INF/lib"/>
<copy file="${jsf.api.jar}" todir="${builddir}/WEB-INF/lib" verbose="true"/>
<copy file="${jsf.impl.jar}" todir="${builddir}/WEB-INF/lib" verbose="true"/>
</target>
<target name="el-libs" if="use-el-libs" unless="glassfish">
<copy file="${el.api.jar}" todir="${builddir}/WEB-INF/lib"
verbose="true" failonerror="false"/>
<copy file="${el.impl.jar}" todir="${builddir}/WEB-INF/lib"
verbose="true" failonerror="false"/>
</target>
<target name="bean-validation-libs" if="use-bean-validation-libs" unless="glassfish">
<copy file="${bean-validation.impl.jar}" todir="${builddir}/WEB-INF/lib"
verbose="true" failonerror="false"/>
<copy todir="${builddir}/WEB-INF/lib" verbose="true" failonerror="false">
<fileset dir="${bean-validation.lib.dir}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="cdi-libs" if="use-cdi-libs" unless="glassfish">
<copy file="${cdi.impl.jar}" todir="${builddir}/WEB-INF/lib"
verbose="true" failonerror="false"/>
</target>
<target name="tomcat-libs" depends="jsf-libs, el-libs, bean-validation-libs, cdi-libs"/>
<target name="war" depends="clean, compile, tomcat-libs"
description="Build WAR file.">
<delete file="${warfile}"/>
<jar jarfile="${warfile}" basedir="${builddir}"/>
</target>
<target name="install" depends="war"
description="Deploy web application.">
<copy file="${warfile}" todir="${deploy.dir}"/>
</target>
<target name="clean" depends="init"
description="Clean everything.">
<delete dir="${builddir}"/>
</target>
</project>