-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
77 lines (67 loc) · 2.5 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="WeatherApp" basedir="." default="build">
<property file="build.properties" />
<!-- Setting the classpath for the project -->
<path id="project.classpath">
<pathelement location="${build.dir}/classes" />
<fileset dir="${lib.dir}" />
<fileset dir="${tomcat.lib.dir}" />
</path>
<target name="build" depends="clean" description="Building project">
<javac srcdir="${src.dir}" destdir="${build.dir}/classes" debug="on" includeAntRuntime="false">
<classpath refid="project.classpath" />
<compilerarg value="-Xlint:none" />
</javac>
<copy todir="${build.dir}/classes">
<fileset dir="${resource.dir}" />
</copy>
</target>
<target name="webapp-init" description="Create webapp directory structure">
<copy todir="${dist.dir}">
<fileset dir="${web.dir}">
<exclude name="**/src/**" />
</fileset>
</copy>
<copy todir="${dist.dir}/WEB-INF">
<fileset dir="${build.dir}" />
</copy>
<copy file="${readme.file}" todir="${dist.dir}" />
</target>
<target name="war" depends="build, webapp-init" description="Create Web Application Archive">
<war destfile="${dist.dir}/${ant.project.name}.war" needxmlfile="false" basedir="${dist.dir}" />
<delete includeemptydirs="true">
<fileset dir="${dist.dir}" excludes="*.war"/>
</delete>
</target>
<target name="deploy" depends="war"
description="Deploy compiled and packaged Web Application to Tomcat webapps directory">
<copy file="${dist.dir}/${ant.project.name}.war" todir="${deploy.dir}" />
</target>
<target name="start-server" description="Starts Apache Tomcat server">
<exec dir="${tomcat.dir}/bin" executable="${terminal}" os="${os}">
<arg line="${start.server.arg}" />
</exec>
</target>
<target name="stop-server" description="Stops Apache Tomcat server">
<exec dir="${tomcat.dir}/bin" executable="${terminal}" os="${os}">
<arg line="${stop.server.arg}" />
</exec>
</target>
<target name="restart-server" description="Restarts Apache Tomcat server">
<antcall target="stop-server" />
<waitfor maxwait="10" maxwaitunit="second">
<not>
<socket server="localhost" port="8080"/>
</not>
</waitfor>
<antcall target="start-server" />
</target>
<target name="clean" description="Clean up">
<delete dir="${dist.dir}" />
<delete includeemptydirs="true">
<fileset dir="${build.dir}/classes" includes="**/*" />
</delete>
<delete dir="${deploy.dir}/${ant.project.name}" />
<delete file="${deploy.dir}/${ant.project.name}.war" />
</target>
</project>