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 https://github.com/biemond/soa_tools/tree/master/maven_osb_ps5 or the PS6 version https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6
or with the new PS6 configjar tool which can create offline OSB exports without OEPE http://biemond.blogspot.nl/2013/04/offline-oracle-service-bus.html 

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 11.1.1.6 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 . osb.sh 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 
-DconnectionUrl=scm:git:git@github.com:biemond/soa_tools.git



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

10 comments:

  1. Is it working under 11.1.1.5?

    ReplyDelete
    Replies
    1. Hi,

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

      thanks

      Delete
  2. Thank you for this article so interesting.

    The use of maven is a breakthrough for OSB project developers

    Regards

    ReplyDelete
  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

    ReplyDelete
    Replies
    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

      thanks

      Delete
    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 java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      Could not find the main class: org.eclipse.equinox.launcher.Main. Program will exit.

      Any pointers please

      Delete
    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.

      thanks

      ${eclipse.home}/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
      ${osb.home}/modules/com.bea.common.configfwk_1.6.0.0.jar
      ${osb.home}/modules/com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar
      ${osb.home}/lib/alsb.jar
      ${osb.home}/lib/sb-kernel-wls.jar
      ${osb.home}/lib/sb-kernel-impl.jar
      ${osb.home}/lib/sb-kernel-api.jar
      ${weblogic.home}/server/lib/weblogic.jar
      ${weblogic.home}/server/lib/wls-api.jar

      Delete
  4. Hi,

    I uploaded the OSB maven PS6 or 11.1.1.7 version to the soa_tools github repos
    https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6


    ReplyDelete
    Replies
    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.
      http://biemond.blogspot.nl/2013/04/offline-oracle-service-bus.html

      Thanks

      Delete