Skip to content

Commit

Permalink
Move examples to examples project
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Dec 24, 2008
1 parent 250fe16 commit 235ee21
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions build.xml
@@ -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>

0 comments on commit 235ee21

Please sign in to comment.