Using Maven to build & deploy SOA/BPEL project on SOA Suite 11gRx

The Maven integration with SOA Suite 11gRx is lacking but Oracle provide since version 12c a better integration with the tools: http://docs.oracle.com/middleware/1212/core/MAVEN/config_maven.htm#CDCIBGJA
The ANT script provided in $MIDDLEWARE_HOME/Oracle_SOA1/bin give some facilities to build, compile and deploy. This is working fine until you need to include this deployment process into your customer environment using continuuous integration (with maven & jenkins for example).

Once your Maven environement is setup, you can add custom JAR using for example the following command

MIDDLEWARE_HOME=E:\middleware\mid70
mvn install:install-file -DgroupId=oracle.soa.fabric_11.1.1 -Dversion=11.1.1.7.0 -Dpackaging=jar -DgeneratePom=true -DartifactId=fabric-runtime -Dfile=%MIDDLEWARE_HOME%\Oracle_SOA1\soa\modules\oracle.soa.fabric_11.1.1\fabric-runtime.jar 

You can use the following pom.xml file to build & deploy to your WLS SOA server instance

<project 	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
					xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>home.composites</groupId>
	<artifactId>soaHelloWorld</artifactId>
	<packaging>pom</packaging>
	<version>1.0</version>
	<name>Flow ${project.groupId}.${project.artifactId} v${project.version}</name>
	<properties>
		<bea.home>E:\middleware\mid70</bea.home>
		<server.url>http://localhost:7001</server.url>
		<server.user>weblogic</server.user>
		<server.password>Welcome1</server.password>
	</properties>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.6</version>
				<executions>
					<execution>
						<id>sca-package</id>
						<phase>package</phase>
						<configuration>
							<target>
								<property name="scac.application.home" value="${basedir}/.." />
								<property name="build.compiler" value="extJavac"/>
								<property name="compositeName" value="${project.artifactId}" />
								<property name="compositeDir" value="${basedir}" />
								<property name="revision" value="${project.version}" />
								<ant antfile="${bea.home}/Oracle_SOA1/bin/ant-sca-package.xml"
									 dir="${bea.home}/Oracle_SOA1/bin"
									 target="package" />
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
					
					<execution>
						<id>sca-undeploy</id>		
						<phase>deploy</phase>		
						<configuration>
							<target>
								<property name="serverURL" value="${server.url}" />
								<property name="user" value="${server.user}" />
								<property name="password" value="${server.password}" />
								<property name="compositeName" value="${project.artifactId}" />
								<property name="revision" value="${project.version}" />
								<property name="sarLocation" value="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" />
								<property name="overwrite" value="true" />
								<property name="forceDefault" value="true" />
								<property name="partition" value="default" />
								<ant antfile="${bea.home}/Oracle_SOA1/bin/ant-sca-deploy.xml"
									 dir="${bea.home}/Oracle_SOA1/bin"
									 target="undeploy" />
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>					
					
					<execution>
						<id>sca-deploy</id>
						<phase>install</phase>
						<configuration>
							<target>
								<property name="serverURL" value="${server.url}" />
								<property name="user" value="${server.user}" />
								<property name="password" value="${server.password}" />
								<property name="sarLocation" value="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" />
								<property name="overwrite" value="true" />
								<property name="forceDefault" value="true" />
								<property name="partition" value="default" />
								<ant antfile="${bea.home}/Oracle_SOA1/bin/ant-sca-deploy.xml"
									 dir="${bea.home}/Oracle_SOA1/bin"
									 target="deploy" />
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>

More to come …

Advertisements

About Chenda Mok

19 years of hands on experience in software design and development with emphasis on Enterprise Application Integration (EAI), Services Oriented Architecture (SOA) and Identity Management (IDM) solutions. I’m a software engineer, member of the professional service delivery team working for Salesforce. Prior to this, I worked for Oracle as Solution Architect, through SeeBeyond(06/2005), then SUN’s acquisition (04/2009). After my master’s degree in computer science in 1997; I always delivered consulting on architecture, design, implementation on integration’s field. I’m interested in architecture using EAI/SOA/IDM/BPM/Cloud technologies, software development and Java’s related technologies. I may blog about my work/activities at Salesforce, but I do not speak for my employer, past, present or future.
This entry was posted in Uncategorized. Bookmark the permalink.