Sunday, October 7, 2012

Build and Deploy OSB projects with Maven

2 years ago I already did the same with ANT and now I migrated these scripts to Maven. These Maven poms can still do the same like my ANT scripts.
  • Build and deploy an OSB OEPE workplace
  • Build one OSB project.
  • Export OSB projects from an OSB server and generate a customization plan.
Here you can find my code or the PS6 version
or with the new PS6 configjar tool which can create offline OSB exports without OEPE 

Also the readme contains some examples how to this from Java without the help of Maven or Ant.

I based my scripts on the following software and folders

My Environment Oracle OSB PS5 or with Maven 3.0.4

JVM                         = JDK 1.7_07 x64
Middleware home      = /opt/oracle/wls/wls11g
OSB & Oracle home = /opt/oracle/wls/wls11g/Oracle_OSB1
WebLogic home       = /opt/oracle/wls/wls11g/wlserver_10.3
Oepe home               = /opt/oracle/wls/wls11g/oepe11.1.1.8

My Maven settings.xml

run . to set all the Maven, Java variables.

To build a project or the whole OEPE workspace use this
mvn package

To deploy or export an existing OSB server use this target-env=dev so it uses the right Maven profile for the WebLogic Settings
mvn deploy -Dtarget-env=dev

Prepare a release
mvn release:prepare

Perform a release
mvn release:perform -Dtarget-env=dev

the pom.xml in the Maven_osb_ps5 folder build the whole source folder workspace, this generates a jar in the export folder with the same name as your pom definition.

the pom.xml in the Maven_osb_ps5/source/ReliableMessageWS and Maven_osb_ps5/source/XSDvalidation folder build only this project and generate a jar in the export folder with the same name as your pom definition.

the pom.xml in the Maven_osb_ps5/export folder export everything from the OSB server and puts the jar in the import folder.

Here is an example of a pom which build and deploys the whole OSB OEPE workspace.
This pom has the following plugins

  • exec-maven-plugin for building the OSB jar and deploy the jar to the OSB server, 
  • maven-assembly-plugin for adding the OSB jar as maven artifact 
  • maven-release-plugin for OSB releases. 

And here the assembly to add the generated OSB jar to Maven artifact


  1. Is it working under

    1. Hi,

      It should work also on PS3, just lookup the right classpath jar versions.


  2. Thank you for this article so interesting.

    The use of maven is a breakthrough for OSB project developers


  3. Hi Edwin,

    Do you know if it's possible to export subprojects (a especific folder of a project)?

    And another question, when I export a project using eclipse IDE takes seconds, but if you export a project with the java command (equinox.launcher...) it takes much more? is it possible to export as eclipse does?

    Thanks in advance

    1. Hi,

      nop, only whole workspace or one or more OSB projects. And indeed it takes more but starting up eclipse, svn update etc also takes times and you can automate it now with Hudson


    2. Running this under windows i am running into the following

      [INFO] --- exec-maven-plugin:1.2.1:exec (buildAllFromOEPE) @ osb.all.projects ---
      java.lang.NoClassDefFoundError: org/eclipse/equinox/launcher/Main
      Caused by: java.lang.ClassNotFoundException: org.eclipse.equinox.launcher.Main
      at Method)
      at java.lang.ClassLoader.loadClass(
      at sun.misc.Launcher$AppClassLoader.loadClass(
      at java.lang.ClassLoader.loadClass(
      Could not find the main class: org.eclipse.equinox.launcher.Main. Program will exit.

      Any pointers please

    3. Hi,

      check the wls,osb and oepe path in the maven settings and if these jars in the pom exactly matches with your env.



    4. We are using maven plugin to build OSB project separtely, it works fine but we have few issues
      My Environment details
      OSB version-
      Maven - 3.0.4
      OEPE - oepe11.1.1.8

      We have few issues
      1. When we build the project by executing mvn package it generates below files in Project folder
      security folder with SerializedSystemIni.dat file
      Exported jar file also has these files, is there a way to avoid these files
      When we use the ant version of script these files were not generated, only when we use Maven plugin with command line arguments it is generating these files.

      2. First time it works fine and for the second time when we run the same command to build the project it gives "setting transaction 12 as rollback only" and hangs and in some cases it gives below error
      "Exception in org.eclipse.core.resources.ResourcesPlugin.start() of bundle org.eclipse.core.resources."
      When we delete .metadata folder it works fine, whether every time we need to delete the .metadata folder before running the script.

      3. It takes longer time (in some cases more that 15 minutes for one project) to build and generate the project sbconfig jar, how to optimize it which process is taking more time

    5. Hi,

      you can control the location of the osb files by changing the workingDirectory ${project.basedir}/../../ in the parent pom.

      the .metadata folder is a known issue, can you try my maven build if this is a server , environment issue or something in your osb workspace.

      can you try this on a windows or from a x windows env.

      By the way the new configtool of PS6 is fast,so flexible , no need for eclipse and works great with maven. Here I also added some extra pom propeties to control the build location.



    6. Thanks, I am able to control the osb files by changing the working directory.
      I am running this in Windows only.
      Our requirement is to build each OSB project separately, first time when we build it works fine without any errors, next time on wards it gives below error but still it generates the sbconfig.jar
      How we can avoid this error

      Synchronizing "OSB Configuration"...
      <Setting trans
      action '10' as rollback only. Rollback reason:
      at com.bea.wli.config.task.impl.GetSnapshotTask.getCurrentSnapshot(GetSn
      at com.bea.wli.config.task.impl.GetSnapshotTask._execute(GetSnapshotTask
      at com.bea.wli.config.task.impl.GetSnapshotTask$2._execute(GetSnapshotTa
      at com.bea.wli.config.task.impl.SessionedTask$1.execute(SessionedTask.ja
      at com.bea.wli.config.transaction.TransactionalTask._doExecute(Transacti
      at com.bea.wli.config.transaction.TransactionalTask._doExecuteWithRetry(
      at com.bea.wli.config.transaction.TransactionalTask.doExecute(Transactio
      at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.ja
      at com.bea.wli.config.task.impl.SessionedTask.doExecute(SessionedTask.ja
      at com.bea.wli.config.task.impl.GetSnapshotTask.getDigestSnapshot(GetSna
      at com.bea.wli.config.task.impl.GetSnapshotTask.getDigestSnapshot(GetSna
      nknown Source)
      nknown Source)


    7. Hi,

      Do you check in your sources in svn like the .metadata folder or do not clean before. this way you always get a fresh install and maybe you can check the changes after the first run.


  4. Hi,

    I uploaded the OSB maven PS6 or version to the soa_tools github repos

    1. Hi All,

      I made a new blogpost about the new OSB PS6 offline configjar tool ( made 2 versions , one with a shell script and how to do this in maven.


  5. HI Edwin,

    Currently i am working on OFM 12C pom.xml build and deploy for SOA,BPM,OSB, Java and ADF stuff.

    Can you plz provide me link for OFM12C pom.xml step ups for all SOA,BPM,OSB, Java and ADF.