deployment of process definition using ant task
jgerlach Aug 2, 2005 12:50 PMHere's a build.xml I use. Its a it of a hack, but it works. I was having classpath issues so there are probably duplicate jars - but it works so I left it alone.
My setup is jboss-4.0.3RC1 with JBPM 3.0 deployed to a jbpm directory. The JBPM data is using HSQL although it will work with other DB's. I'm using the versioning approach so my custom controllers and ActionHandlers are in src/java and the processdefinition.xml and gpd.xml are in src/process. The classpath seems to need as least: Ant, Hypersonic, JBPM, and whatever you process may be calling.
In my case, this process is calling some external EJB3 stuff, so I needed to add those to the classpath.
<project name="CustomerTicketProcess" basedir="." default="deploy.par">
<description>CustomerTicketProcess build</description>
<property file="build.properties"/>
<!-- ================= -->
<!-- === CLASSPATH === -->
<!-- ================= -->
<path id="classpath">
<pathelement path="build/classes"/>
<pathelement path="src/config.files"/>
<fileset dir="C:/jboss-4.0.3RC1/server/jbpm/lib" includes="**/*.jar"/>
<fileset dir="C:/eclipse3.1-JBoss1.5M2/jbpm_ejb3/jbpm.3/lib" includes="**/*.jar"/>
<fileset dir="C:/jboss-4.0.3RC1/server/jbpm/deploy/jbpm.sar" includes="**/*.jar"/>
</path>
<path id="classpath.ant">
<pathelement path="build/classes"/>
<fileset dir="c:/ant" includes="**/*.jar"/>
</path>
<path id="classpath.hsqldb">
<fileset dir="${jboss.home}/server/jbpm.template/lib" includes="hsqldb.jar"/>
</path>
<target name="compile" description="compiles src/javas">
<mkdir dir="build/classes"/>
<javac srcdir="src/java/cypress" destdir="build/classes" debug="on" fork="yes">
<classpath refid="classpath"/>
</javac>
</target>
<target name="build.processes" depends="compile" description="builds the processes">
<mkdir dir="build/processes/CustomerTicket"/>
<mkdir dir="build/processes/CustomerTicket/classes"/>
<copy todir="build/processes/CustomerTicket">
<fileset dir="src/process/CustomerTicket.par"/>
</copy>
<copy todir="build/processes/CustomerTicket/classes">
<fileset dir="build/classes" includes="net/**"/>
</copy>
<zip destfile="build/CustomerTicket.par">
<fileset dir="build/processes/CustomerTicket"/>
</zip>
</target>
<!-- ================= -->
<!-- TASK DECLARATIONS -->
<!-- ================= -->
<target name="deploy.par" depends="build.processes">
<taskdef name="deploypar" classname="org.jbpm.ant.DeployParTask">
<classpath refid="classpath"/>
</taskdef>
<deploypar>
<fileset dir="build" includes="CustomerTicket.par"/>
</deploypar>
</target>
<target name="deploy.par.startdb" depends="build.processes">
<antcall target="db.start"/>
<taskdef name="deploypar" classname="org.jbpm.ant.DeployParTask">
<classpath refid="classpath"/>
</taskdef>
<deploypar>
<fileset dir="build" includes="*.par"/>
</deploypar>
<antcall target="db.stop"/>
</target>
<property name="hsqldb.database" value="${jboss.home}/server/jbpm/data/hypersonic/default"/>
<property name="hsqldb.port" value="1701"/>
<target name="db.start" depends="declare.jbpm.tasks">
<starthsqldb lib="${jboss.home}/server/jbpm/lib/hsqldb.jar"
database="${hsqldb.database}"
port="${hsqldb.port}" />
</target>
<target name="db.start.mgr">
<antcall target="db.start"/>
<java classname="org.hsqldb.util.DatabaseManager" fork="true">
<classpath refid="classpath.hsqldb"/>
<arg line="-url jdbc:hsqldb:hsql://localhost:${hsqldb.port}"/>
</java>
<antcall target="db.stop"/>
</target>
<target name="db.stop">
<java classname="org.hsqldb.util.ShutdownServer" fork="true">
<classpath refid="classpath.hsqldb"/>
<arg line="-url jdbc:hsqldb:hsql://localhost:${hsqldb.port} -user sa"/>
</java>
</target>
<!-- ================= -->
<!-- TASK DECLARATIONS -->
<!-- ================= -->
<target name="declare.jbpm.tasks">
<taskdef file="src/config.files/jbpm.ant.tasks.properties" format="properties">
<classpath>
<path refid="classpath.ant"/>
<path refid="classpath"/>
</classpath>
</taskdef>
</target>
</project>