-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·84 lines (71 loc) · 3.26 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
<project name="bees-build" default="dist" basedir=".">
<description>
Application build file
</description>
<property environment="env" />
<property name="src" location="src" />
<property name="webapp.dir" location="webapp" />
<property name="classes" location="${webapp.dir}/WEB-INF/classes" />
<property name="lib.dir" location="lib" />
<property name="build" value="build" />
<property name="build.dir" location="${build}" />
<property name="war.file" location="${build}/webapp.war" />
<property name="src.file" location="${build}/webapp-src.zip" />
<!-- set default values for bees tasks -->
<property name="bees.appid" value="" />
<property name="run.port" value="8080" />
<property name="run.environment" value="" />
<path id="webapp.classpath">
<fileset dir="${webapp.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${classes}" />
</target>
<target name="clean" description="clean up">
<delete dir="${classes}" />
<delete dir="${build.dir}" />
<delete dir="${webapp.dir}/WEB-INF/classes" />
</target>
<target name="compile" depends="init" description="compile the source ">
<javac srcdir="${src}" destdir="${classes}" classpathref="webapp.classpath" />
<copy todir="${classes}">
<fileset dir="${src}" excludes="**/*.java" />
</copy>
</target>
<target name="dist" depends="compile" description="generate the distribution">
<mkdir dir="${build.dir}" />
<war destfile="${war.file}" basedir="${webapp.dir}" webxml="${webapp.dir}/WEB-INF/web.xml" />
<zip destfile="${src.file}">
<zipfileset dir="${basedir}">
<exclude name="${build}/**" />
<exclude name="${webapp.dir}/WEB-INF/classes/**" />
</zipfileset>
</zip>
</target>
<target name="deploy" depends="dist,bees-classpath" description="deploy the distribution to CloudBees">
<taskdef name="deploy" classname="com.staxnet.ant.DeployTask">
<classpath refid="staxtasks.class.path" />
</taskdef>
<deploy deployfile="${war.file}" appid="${bees.appid}" />
</target>
<target name="run" depends="compile,bees-classpath" description="run the application in CloudBees">
<taskdef name="run" classname="com.staxnet.ant.RunWarTask">
<classpath refid="staxtasks.class.path" />
</taskdef>
<run workingdir="${build.dir}/staxcat" webappdir="${webapp.dir}" port="${run.port}" environment="${run.environment}" />
</target>
<target name="bees-classpath">
<property environment="env" />
<fail message="BEES_HOME environment is not set" unless="env.BEES_HOME" />
<property name="bees.home" value="${env.BEES_HOME}"/>
<echo message="bees home: ${bees.home}" />
<path id="staxtasks.class.path">
<fileset dir="${bees.home}/lib" includes="*.jar"/>
</path>
</target>
</project>