How to create maven build POM file for Oracle BPEL 12.1.3 project
Before proceed to create POM file. We need to create Oracle SOA repository. The following command will create the repositotirs.
- Assume the Oracle BPM 12.1.3 installed on the directory C:\Oracle\Middleware\Oracle_Home
- Set the following property
export M2_HOME=C:\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.maven_3.0.5 export PATH=${M2_HOME}/bin:$PATH
- Download the wagon-http-2.8-shaded.jar and place it under the M2_hOME\lib directoty
- Optionally, update the Oracle repository in your Maven settings.xml file . This will give access to Maven to download jar from Oracle Maven URL. Replace the Username and password with yours
maven.oracle.com USERNAME PASSWORD ANY ANY OAM 11g http.protocol.allow-circular-redirects %b,true maven.oracle.com true false https://maven.oracle.com default maven.oracle.com https://maven.oracle.com
- Go to the Maven Sync Plugin directory and install the Oracle Sync plugin
cd C:\Oracle\Middleware\Oracle_Home\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3 mvn install:install-file -DpomFile=./oracle-maven-sync-12.1.3.pom -Dfile=./oracle-maven-sync-12.1.3.jar
- Test the Oracle repository using testingOnly=true
mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=c:\Oracle\Middleware\Oracle_Home\ -DtestingOnly=true
- Install the Oracle repositories using testingOnly = true
mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=c:\Oracle\Middleware\Oracle_Home\ -DtestingOnly=false
- Do the Maven CRAWL.
cd C:\Oracle\Middleware\Oracle_Home\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3 mvn archetype:crawl -Dcatalog=C:\Users\dz0003\.m2\archetype-catalog.xml
Sample archetype-catalog.xml in C:\Users\dz0003\.m2. JDeveloper look for this file when you create POM from Archetype
com.oracle.adf.archetype oracle-adffaces-ejb12.1.3-0-0 adfFusionWebapp com.oracle.coherence maven-gar-archetype12.1.3-0-0 maven-gar-archetype com.oracle.servicebus.archetype oracle-servicebus-application12.1.3-0-0 oracle-servicebus-application com.oracle.servicebus.archetype oracle-servicebus-project12.1.3-0-0 project com.oracle.servicebus.archetype oracle-servicebus-system12.1.3-0-0 application com.oracle.soa.archetype oracle-soa-application12.1.3-0-0 maven-sar-archetype com.oracle.soa.archetype oracle-soa-project12.1.3-0-0 maven-sar-archetype com.oracle.weblogic.archetype basic-mdb12.1.3-0-0 basicMDB com.oracle.weblogic.archetype basic-webapp12.1.3-0-0 basicJsf com.oracle.weblogic.archetype basic-webapp-ejb12.1.3-0-0 cdi com.oracle.weblogic.archetype basic-webservice12.1.3-0-0 basicWebservice
Create Pom for Oracle BPEL projects and Applications
- Build SOA Application:
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.mycompany -DartifactId=my-soa-app -Dversion=1.0-SNAPSHOT -DprojectName=my-project
- Build SOA Project:
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-project -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.mycompany -DartifactId=my-second-project -Dversion=1.0-SNAPSHOT
Deploy SOA Project:
mvn archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-project -DarchetypeVersion=12.1.3-0-0 -DgroupId=org.mycompany -DartifactId=my-second-project -Dversion=1.0-SNAPSHOT
- Undeploy SOA Project
mvn com.oracle.soa.plugin:oracle-soa-plugin:undeploy -DserverURL=http://test.server:7001 -Dcomposite.name=my-project -Dcomposite.revision=1.0 -Dcomposite.partition=test -Duser=weblogic -Dpassword=welcome1
- We can also create Maven POM from JDeveloper . To do that, right click on the BPEL/SOA project , New, Search for maven and select Maven POM for Project
Sample BPEL Project POM File:
4.0.0 APPLICATIONAME PROJECTNAME1.0 sar com.oracle.soa sar-common12.1.3-0-0 ${project.basedir}\SOA/ ${project.basedir}/target ${scac.input.dir}/composite.xml ${scac.output.dir}/out.xml ${scac.output.dir}/error.txt 1 ${project.artifactId} 1.0 default ${oracleServerUrl} ${oracleUsername} ${oraclePassword} true true false false ${scac.output.dir}/testResult ${project.artifactId}org.apache.maven.plugins maven-surefire-plugin2.19.1 false com.oracle.soa.plugin oracle-soa-plugin12.1.3-0-0 ${project.artifactId} ${scac.input} ${scac.output.dir}/sca_${project.artifactId}_rev${composite.revision}.jar ${serverUrl} ${user} ${password} ${composite.revision} ${composite.revision} ${scac.input.dir} ${input}true
Sample BPEL Project with Java activity with jar dependancy SCA-INF\lib directory:
4.0.0 ApplicationName ProjectName1.0 sar com.oracle.soa sar-common12.1.3-0-0 ${project.basedir} ${project.basedir}/target ${scac.input.dir}/composite.xml ${scac.output.dir}/out.xml ${scac.output.dir}/error.txt 1 ${project.artifactId} 1.0 default ${oracleServerUrl} ${oracleUsername} ${oraclePassword} true true false false ${scac.output.dir}/testResult ${project.artifactId}org.apache.maven.plugins maven-dependency-plugin3.0.2 copy validate copy org.apache.commons commons-lang33.7 jar false ${scac.input.dir}/SCA-INF/lib org.apache.maven.plugins maven-surefire-plugin2.19.1 false com.oracle.soa.plugin oracle-soa-plugin12.1.3-0-0 ${project.artifactId} ${scac.input} ${scac.output.dir}/sca_${project.artifactId}_rev${composite.revision}.jar ${serverUrl} ${user} ${password} ${composite.revision} ${composite.revision} ${scac.input.dir} ${input}**/target/ true
Oracle BPEL Application POM:-
4.0.0 ApplicationName ApplicationName1.0-SNAPSHOT Super POM BPELProject1 BPELProject2 BPELProject2 pom
Maven Test Commands
- Undeploy a Partition from the default partition
cd to your pom.xml mvn com.oracle.soa.plugin:oracle-soa-plugin:undeploy -Dpartition=default
- Compile the Project
cd to your BPEM PROJECT where the pom.xml is located mvn com.oracle.soa.plugin:oracle-soa-plugin:compile -DoracleHome=c:\Oracle\Middleware\Oracle_Home\soa -DappHome=
- Package the Project
cd to your BPEM PROJECT where the pom.xml is located mvn package -DoracleHome=c:\Oracle\Middleware\Oracle_Home\soa -DappHome=
- Deploy the Project
mvn pre-integration-test -DoracleHome=c:\Oracle\Middleware\Oracle_Home\soa -DappHome=-Dpartition=default
Troubleshooting:
- I faced the following error during the deployment face
[ERROR] Unresolveable build extension: Plugin com.oracle.soa.plugin:oracle-soa-plugin:12.1.3-0-0 or one of its dependencies could not be resolved: Failed to collect dependencies for com.oracle.soa.plugin:oracle-soa-plugin:jar:12.1.3-0-0 (): No versions available for com.oracle.weblogic:weblogic:jar:[12.1.3,12.1.4) within specified range -> [Help 2]
- The solution would be to find the pom file in the repository where the [12.1.3,12.1.4) is written and replace it with 12.1.3-0-0. One of the way to find the above text in your repository and replace is using Notepad++ in windows.
- Open Notepad++ and do CTRL+SHIFT+F , Click Find in Files tab , Search for the appropriate text and replace it like below.
Another issue is some jars are missing in repository. I used the following windows powershell command to find the jar from Oracle Home and place it in repository
Get-ChildItem -recurse | Select-String -pattern "logging-utils-1.0.jar" | group path | select name
This post first appeared on Oracle ADF, BPM, BI And Primavera P6 Tutorials, please read the originial post: here