Skip to main content

SOA/OSB 12C Maven Implementation

Recently I came up with a video of “Mark Nelson”, where he shown how we can use maven SOA 12+ version to create SOA project from scratch and how maven can help us to create build and deployment of same to server.
Today we are going to see how maven is configured and how SOA project is created from it and how maven deploy build on SOA server.

Step 1: Go to oracle home maven location in my case it is “C:\Oracle12C_BPM\Middleware\Oracle_Home\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.2.1”.
                                                                                OR
% ORACLE_HOME %\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3
Open command prompt and go to step one dir location.

Step 2: Run the Maven install command.
mvn install:install-file -Dfile=oracle-maven-sync-12.2.1.jar -DpomFile=oracle-maven-sync-12.2.1.pom
SET ORACLE_HOME=C:\Oracle12C_BPM\Middleware\Oracle_Home
Check Oracle_home is set or not with echo command.
mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=%ORACLE_HOME%
These commands will take time, As multiple JARS will be downloaded.
if you see mvn is not an installed command, You need to set “M2_HOME” and “PATH” system variables.
In my case, I had configured them on command level only.
SET M2_HOME=E:\Tools\maven-3.5.0
SET PATH=%M2_HOME%\bin;%PATH%
After it we will run MVN command provided in second step.
Now it will download MVN repo and required JAR files to your SOA ENV, You can see that in command prompt where you executed this command.

Step 3: Update your archetype catalog using
mvn archetype:crawl -Dcatalog=C:\Users\<<uname>>\.m2\archetype-catalog.xm
In my case:
mvn archetype:crawl -Dcatalog=C:\Users\Sandeep\.m2\archetype-catalog.xm
This command will take some time as it will scan & update downloaded JARs.

Step 4: Generate SOA Application and project as shown below. This generates SOA application test-sandeep-application with  project test-sandeep-project.

SOA:
mvn -X archetype:generate -DarchetypeGroupId=com.oracle.soa.archetype -DarchetypeArtifactId=oracle-soa-application -DarchetypeVersion=12.2.2-0-0 -DgroupId=org.my.test -DartifactId=test-sandeep-application -DprojectName=test-sandeep-project -Dversion=1.0-SNAPSHOT

OSB:
mvn archetype:generate -DarchetypeGroupId=com.oracle.servicebus.archetype -DarchetypeArtifactId=oracle-servicebus-application -DarchetypeVersion=12.2.1-2-0 -DgroupId=org.my.test -DartifactId=test-servicebus-application -DprojectName=test-servicebus-project -Dversion=1.0-SNAPSHOT
Here we used -X for debugging so we can see what processing is running to create SOA project.

SOA project create status:
It will ask for confirmation, Press “Y”


@Note: If you faced any error related to NO Jar Found for version “12.2.2-0-0” or “12.2.1-2-0”, open your maven repo and go to desired location and check for POM file whether it has complete pom file or not.

Import this maven project in JDeveloper using File –> Import and select the Maven Project option as shown below. Click OK.


Click OK if you get any error related to overriding the existing project dialog so that jws file is created. Now your project explorer should look like as below.


Open project level POM file in Resources directory of SOA Project and observe the details.

Compile SOA Application using mvn compile (from directory of SOA Application).
Modify server details in project level POM file as shown below and deploy your SOA projects using mvn pre-integration-test (from SOA application directory).

After execution, you will see following output and also can observe the SOA project deployed to SOA server as shown below.

You can execute SOA Plugin goals in the following manner from the directory containing project POM file.
mvn com.oracle.soa.plugin:oracle-soa-plugin:compile
mvn com.oracle.soa.plugin:oracle-soa-plugin:sar
mvn com.oracle.soa.plugin:oracle-soa-plugin:deploy
mvn com.oracle.soa.plugin:oracle-soa-plugin:undeploy
You can observe goal prefix as oracle-soa, when you describe the SOA Plugin as shown below.
so you can execute all goals simply using this goal prefix as below.
mvn oracle-soa:compile
mvn oracle-soa:sar
mvn oracle-soa:deploy
mvn oracle-soa:undeploy

Note: Use double quotes in the maven commands like below if you are seeing the error mentioned in this link.
mvn install:install-file “-DpomFile=oracle-maven-sync-12.1.3.pom” “-Dfile=oracle-maven-sync-12.1.3.jar” “-DoracleHome=C:/Oracle/Middleware/FMW1213New”


Comments

  1. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles.Oracle OSB Online Training

    ReplyDelete
  2. -Doracle-maven-sync.oracleHome=%ORACLE_HOME% is not working. It should be -DoracleHome=%ORACLE_HOME%

    ReplyDelete
  3. I have so many blog but out of those i feel this is a good one.
    Oracle Integration Cloud Service Online Training

    ReplyDelete

Post a Comment