Build OSB 12c sbar file with Maven

If you want to have build and deployment of Oracle Service Bus 12c (OSB12c) projects with Maven, you need to follow the below steps. I have tested this myself and it works. I you have any question, just drop me a message.

download maven and unzip it into /data/app/maven/apache-maven-3.5.4

set environment variables in you active session.

export JAVA_HOME=/data/app/java/jdk1.8.0_112
export MVN_HOME=/data/app/maven/apache-maven-3.5.4/bin
export M2_HOME=/data/appdata/.m12c

#Specifiek voor Maven build
export ORACLE_HOME=/data/appdata/oracle/Middleware12/Oracle_Home
export MW_HOME=/data/appdata/oracle/Middleware12/Oracle_Home

# Path settings

— First you need to add username and password to you setting to be able to download the Oracle plugins for Maven

  • encrypt your Oracle Single Sign On password with:
    • mvn –encrypt-master-password <yourpassword>
  • create file: ‘settings-security.xml’, put it in you maven home folder  ~/.m2/settings-security.xml

<?xml version=”1.0″ encoding=”UTF-8″?>

  • encrypt your Oracle Single Sign On password again , this time with:
    • mvn –encrypt-password <yourpassword>
  • Add this password to your  ‘settings.xml’ file as follows, it the file is not there just run any maven command to generate it. this will be generated in your Maven home folder ~/.m2/

Add this to your servers tag

<realm>OAM 11g</realm>

Now you can start installing maven libs.

— install Maven libs into oracle_home
— go to /data/appdata/oracle/Middleware12/Oracle_Home/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1

mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar

— Deploy all libs
mvn -DoracleHome=/data/appdata/oracle/Middleware12/Oracle_Home

— to validate the imports Go to oracle_home
mvn help:describe -DartifactId=oracle-servicebus-plugin -Dversion=12.2.1

— go to C:\oracle\Middleware12\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.2.1
mvn archetype:crawl -Dcatalog=/data/appdata/.m12c/archetype-catalog.xml


— Go to the project dir and:

— build with
mvn package

— deploy with

mvn clean install

NOTE: when you want to deploy, you need to have server info in your project POM file.




Leave a Reply

Your email address will not be published. Required fields are marked *