/
build.xml
88 lines (70 loc) · 3.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
<project basedir="." name="example.build.script" default="restart">
<dirname property="wbri.dir" file="${ant.file.example.build.script}/../" />
<property name="maven.dir" location="${wbri.dir}/lib/maven" />
<property file="${wbri.dir}/jboss-as/build.properties"/>
<property name="final.url" value="http://localhost:8080/${example.name}" />
<property name="type" value="war" />
<condition property="war">
<equals arg1="${type}" arg2="war"/>
</condition>
<condition property="ear">
<equals arg1="${type}" arg2="ear"/>
</condition>
<condition property="artifact.target.dir" value="${basedir}/target">
<equals arg1="${type}" arg2="war"/>
</condition>
<condition property="artifact.target.dir" value="${basedir}/${example.name}-ear/target">
<equals arg1="${type}" arg2="ear"/>
</condition>
<property name="artifact.dir" value="${artifact.target.dir}/${example.name}" />
<target name="package">
<maven target="package" basedir="${basedir}"/>
</target>
<target name="explode" depends="package">
<mkdir dir="${jboss.home}/server/default/deploy/${example.name}.${type}"/>
<copy todir="${jboss.home}/server/default/deploy/${example.name}.${type}">
<fileset dir="${artifact.dir}" />
</copy>
</target>
<target name="deploy" depends="package">
<copy todir="${jboss.home}/server/default/deploy/" file="${artifact.target.dir}/${example.name}.${type}"/>
<echo message="The app can be accessed at ${final.url}" />
</target>
<target name="clean">
<maven target="clean" basedir="${basedir}"/>
</target>
<target name="restart.war" depends="explode" if="war">
<touch file="${jboss.home}/server/default/deploy/${example.name}.war/WEB-INF/web.xml" />
</target>
<target name="restart.ear" depends="explode" if="ear">
<touch file="${jboss.home}/server/default/deploy/${example.name}.ear/META-INF/application.xml" />
</target>
<target name="restart" depends="restart.war, restart.ear">
<echo message="The app can be accessed at ${final.url}" />
</target>
<target name="undeploy">
<delete dir="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
<delete file="${jboss.home}/server/default/deploy/${example.name}.${type}" failonerror="false" />
</target>
<macrodef name="maven">
<attribute name="target" />
<attribute name="basedir" />
<element name="args" implicit="true" optional="true" />
<sequential>
<java classname="org.codehaus.classworlds.Launcher" fork="true" dir="@{basedir}" failonerror="true">
<classpath>
<fileset dir="${maven.dir}/boot">
<include name="*.jar" />
</fileset>
<fileset dir="${maven.dir}/bin">
<include name="*.*" />
</fileset>
</classpath>
<sysproperty key="classworlds.conf" value="${maven.dir}/bin/m2.conf" />
<sysproperty key="maven.home" value="${maven.dir}" />
<args />
<arg line="@{target}" />
</java>
</sequential>
</macrodef>
</project>