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

Popular posts from this blog

Oracle SOA 12C rest adapter with Custom HTTP headers

Most existing web applications are connected through web services, which are commonly known as SOAP services. More and more users are relying on mobile devices for communication, and they’re looking for lighter ways to access enterprise information on the go. REST services are the answer for the mobile device platform, because they get rapid responses and fast access to data. Oracle SOA Suite 12 c  provides a complete set of service infrastructure components for designing, deploying, and managing composite applications. Oracle SOA Suite 12 c  enables services to be created, managed, and orchestrated into composite applications and business processes. Some time we have need to send HTTP headers in REST service, In OSB we use header component and add what ever is needed but in oracle SOA 12C it's little bit different. Let see how we can do it. Create one SOA Application. Create one SOA Sample project inside SOA Application. Go to composite and drag drop REST adapt

Dynamic Routing in OSB 12C

Dynamic Routing in OSB cab be used when the BusinessService endpoint required to be determine at runtime in message flow. Consider a scenario where OSB has to route the incoming requests to 2 different services based on the CustomerType element value sent in the payload. So create a XQuery resource with the following contents. Observe that we are using the absolute path of business service in configuration as required by dynamic routing. Following is the XML schema that we use:>>  Customer.xsd <?xml version="1.0" encoding="windows-1252" ?> <xsd:schema targetNamespace="http://xmlns.oracle.com/schema/Customer" xmlns:xsd="http://www.w3.org/2001/XMLSchema"             xmlns:ns1="http://xmlns.oracle.com/schema/Customer">   <xsd:complexType name="Customer">     <xsd:sequence>       <xsd:element name="CustomerId" type="xsd:string"/>       <xsd:elemen

Swagger API document from Any WADL & Schema in Oracle SOA

Hi everyone, Hope everyone is doing well these days, Recently i started a project work over how to generate swagger API document for your any REST API, In case if you don't know what is swagger please go and check " https://swagger.io/tools/swagger-editor/ ". It's a great and easy to use tool which will help to create user friendly, human readable form API documentation with extension for generating API client in different languages with capability of testing your API from same. What is swagger editor, Design, describe, and document your API on the first open source editor fully dedicated to OpenAPI-based APIs. The Swagger Editor is great for quickly getting started with the OpenAPI (formerly known as the Swagger Specification) specification, with support for Swagger 2.0 and OpenAPI 3.0.  What benefits you will get by using swagger, Runs Anywhere, The Editor works in any development environment, be it locally or in the web. Smart Feedback, Validate you