Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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> |