bpel-example

I spent quite a while trying to get Maven to build our Oracle BPEL suitcases. I wanted to do this because I did not want to rely on JDeveloper to deploy the suitcases. That would also not fit into a continuous integration.

The biggest issue we faced was the recursive JAR inclusion that the bpel ant tasks create. So we actually use the existing ant task from Oracle Application Server where we had BPEL installed as well. I have not tried to do this on an installation of bpel without OAS.

I started by creating a module group called BPEL. I wanted to keep each of my suitcases separated from my other code. I also found that the bpel ant task from Oracle will not play well with anything! Especially the site:site documentation from Maven. I would get very misleading errors, and after way too much trial and error, finally tracked it down to these ant tasks. So to solve this I use profiles to not execute the bpel module group during site:site documentation.

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>

<execution>
<id>bpelc</id>
<phase>process-classes</phase>
<configuration>
<tasks>
<ant antfile="${projectRoot}/tools/build-tools/src/main/resources/bpel/common-build.xml"
inheritRefs="true">
<property name="env.BPEL_HOME" value="${bpel.home}"/>
<property name="rev" value="${project.version}"/>
<property name="projectRoot" value="${projectRoot}"/>
<property name="filtersfile" value="${projectRoot}/src/main/filters/filter-${env}.properties"/>
<target name="compile"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>

<execution>
<id>bpelTest</id>
<phase>generate-test-resources</phase>
<configuration>
<tasks>
<ant antfile="${projectRoot}/tools/build-tools/src/main/resources/bpel/common-build.xml"
inheritRefs="true">
<property name="env.BPEL_HOME" value="${bpel.home}"/>
<property name="rev" value="${project.version}"/>
<property name="projectRoot" value="${projectRoot}"/>
<property name="filtersfile" value="${projectRoot}/src/main/filters/filter-${env}.properties"/>
<target name="prepareTests"/>
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>

</executions>

<dependencies>

<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b2</version>
</dependency>

<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0_08</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>com.oracle.j2ee</groupId>
<artifactId>xmlparserv2</artifactId>
<version>10.1.3</version>
</dependency>

</dependencies>
</plugin>

Now for each bpel suitcase module under this group, I would then only need the following plugin declaration:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/bpel_CalculateCOBTotal_${project.version}.jar</file>
<type>jar</type>
<classifier>bpel</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>

Now in order to keep only 1 master copy of our build tasks for the whole project, i created a common-build.xml to consolidate all the bpel ant tasks. Otherwise, JDeveloper would create 1 full build.xml for each suitcase. We had well over 45 suitsaces for phase 1 alone.

– – > common-build.xml is attached to the sources below. But basically all I did was take the bpel ant task from the bpel install, and externalize all the path references within it so it would work with JDeveolper (local build.xml) as well as Maven (ant-run).

For my developers, they wanted to use JDeveloper for creating the bpel flows and that requires a local build.xml that is located at %suitcase-home%\build.xml . This build.xml then just references my common-build

< ! - -
This ant build file was generated by JDev to deploy the BPEL process.
DONOT EDIT THIS JDEV GENERATED FILE. Any customization should be done
in default target in user created pre-build.xml or post-build.xml
- - >

< ! - - Set BPEL process name - - >

< ! - - Set bpel.home from developer prompt's environment variable BPEL_HOME - - >

< ! - - If bpel.home is not yet using env.BPEL_HOME, set it for JDev - - >

< ! - -filter filtersfile="${project.root}/src/main/filters/filter.properties" - - >

Now deploying the bpel suitcases and test zip files also relied upon the bpel ant tasks. I created some batch files, and shell scripts to automate the deployment process. I could have made more updates to allow Maven to do more of the deployment, but did not have time during the project.

#!/bin/ksh
#################################################
# Install script for installing BPEL flows and Unit Tests
# todo: need to filter ${oracle.home}
#################################################

set PATH = $PATH:/opt/oracle/oas/ant/bin;

echo "[INFO] ------------------------------------------------------------------"
echo "[INFO] Deploy bpel_ClaimsPreProcess_${project.version}:"
echo "[INFO] * Depends upon all other C2 BPEL Flows"
echo "[INFO] ------------------------------------------------------------------"
ant deployProcess -Dprocess.name=ClaimsPreProcess -Dproject.version=${project.version}

echo "[INFO] ------------------------------------------------------------------"
echo "[INFO] Deploy bpel_ClaimsPreProcess_${project.version}Tests Test Suite:"
echo "[INFO] ------------------------------------------------------------------"
ant deployTestSuites -Dprocess.name=ClaimsPreProcess -Dproject.version=${project.version}

I did not want to operation team to be forced to have JDevloper, or Maven installed, but I did require that BPEL and OAS was installed, so that I could ensure the same BPEL ant tasks would be present.

And all of the ${…} items above where filtered out by Maven during my build.

Mick Knutson

Java, JavaEE, J2EE, WebLogic, WebSphere, JBoss, Tomcat, Oracle, Spring, Maven, Architecture, Design, Mentoring, Instructor and Agile Consulting. http://www.baselogic.com/blog/resume

View all posts

Java / JavaEE / Spring Boot Channel

BLiNC Supporters

BLiNC Adsense

Archives

Newsletter