Build and release OSB projects with Maven

Edwin Biemond 2
0 0
Read Time:4 Minute, 48 Second

With Maven we are able to build & deploy OSB projects. The artifacts generated by Maven called snaphosts and releases can be automatically uploaded to a software repository. These versioned OSB jars can then be downloaded by the OSB Servers and deployed ( this can be a Test, Acceptance or a Production OSB Server).

In this blogpost I will guide you through this OSB build and release process, so you can do the same with or without Hudson or Jenkens

For this blogpost I will use this maven test project on github, this also contains a working OSB Eclipse Workspace which you can use for your own testing.

First step is to create a Maven POM file and put this on the Eclipse Workspace or Project level. The Workspace pom should build the whole workspace and the pom in a project only that particular OSB project.

The pom always start with the groupId & artifactId and a version.  A normal Maven build will always have an number with snapshot as version, a release will build the OSB project without snapshot and automatically will update the version to a higher number and commits the updated pom.xml with the new higher snapshot version.

For releases we need to provide a version repository and in my case I used git ( it should also work with subversion).

Maven uses plugins to do all the hard work. The first plugin I define in this pom is the exec-maven-plugin. For OSB I can’t use the java plugin because I need to fork a new Java process to set the classpath and the OSB environment variables. Plus I can’t use dependencies libraries, this leads to strange OSB errors.

In the package phase of this plugin I will build the OSB project and in the deploy phase I can deploy this jar to the OSB server.

In the package phase I will call the org.eclipse.equinox.launcher.Main java class and set the following params so I can build the whole workspace

-application com.bea.alsb.core.ConfigExport
-data ${project.basedir}/source
-configProject “OSB Configuration”
-configJar ${project.basedir}/export/${project.artifactId}-${project.version}.jar
-includeDependencies true

For only 1 or more projects I can use these params

-application com.bea.alsb.core.ConfigExport
-data ${project.basedir}/source
-configProject “OSB Configuration”
-configSubProjects “ReliableMessageWS”
-configJar ${project.basedir}/export/${project.artifactId}-${project.version}.jar
-includeDependencies true

For the deploy phase, Maven starts WLST with an script and the following parameters

weblogic.WLST ${project.basedir}/

Cause we are not generating an normal jar, war or ear  so we need to say to maven what the path is of our generated jar. For this we can use the maven-assembly-plugin. This will use the assembly.xml

Here is my assembly.xml , which does an include of the generated OSB jar to a new zip file.

The last maven plugin I use is the maven-release-plugin, This will handle my releases and updates the version number in the pom.

And the last part of the pom is the definition where maven will upload the snapshot and release zips. I will use Artifactory as software repository. It should also work with Nexus.

Besides the pom I also need to configure the maven settings.xml file with my Artifactory server details.

Here are my weblogic environments in the settings.xml file

the default profile settings

And my test profile settings which I can use for my Test deployment.


Now we can build some OSB snapshots and releases.


First we need to set the maven and java environment variables.

do this by running my  osb script “.

Next go to the right pom folder and do a build

mvn package


mvn deploy -Dtarget-env=dev

build and deploy to the dev OSB folder


mvn release:prepare

prepare a release


mvn release:perform -Dtarget-env=dev

Do a release and update the version in the pom.xml


When we look at our Artifactory software repository we will see the new 1.3.7 snapshot and release builds



We can use this release for the Test, Acceptance or Production OSB Server.

To automatically deploy this version I will use a Puppet manifest which uses my WLS and the Artifatory plugin. The Puppet agent will download the right artifact from the software repository and deploy this OSB project to the OSB server

Here is an example of my puppet manifest code. Off course you can create your own scripts which does the same.

 artifactory::artifact {"/tmp/${artifactId}-${version}.zip":
     ensure     => present,
     gav        => "${groupId}:${artifactId}:${version}",
     repository => "libs-release-local",
     packaging  => "zip",
     classifier => "bin", 

  Exec { path      => "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:",
         user      => $user,
         group     => $group,
         logoutput => false,

  exec { "extract OSBAllProjects":
          command => "unzip -j -o /tmp/${artifactId}-${version}.zip *.jar -d /tmp/OSBAllProjects",
          require => Artifactory::Artifact["/tmp/${artifactId}-${version}.zip"],

  # default parameters for the wlst scripts
  Wls::Wlsdeploy {
    wlHome       => $osWlHome,
    osbHome      => $osbHome,
    fullJDKName  => $jdkWls11gJDK,  
    user         => $user,
    group        => $group,
    address      => "localhost",
    wlsUser      => "weblogic",
    password     => "weblogic1",
    port         => "7001",

  # deploy OSB jar to the OSB server 
  wls::wlsdeploy { "deployOSBAllProjects":
      deployType => 'osb',
      artifact   => "/tmp/OSBAllProjects/${artifactId}-${version}.jar",
      customFile => "None",
      project    => "None",
      require    => Exec["extract OSBAllProjects"],


Here is the link to the maven test OSB workspace on github


About Post Author

Edwin Biemond

Software Architect specialized in Middleware, SOA, Security and Web Development.
0 %
0 %
0 %
0 %
0 %
0 %

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

2 thoughts on “Build and release OSB projects with Maven

  1. Hi Edwin,

    I’m running the maven build from shell. I have no issues here. but when I run it from Jenkins(which is running in tomcat) Im getting:

    ../ci/osb/”, line 6, in ?
    ImportError: no module named wli

    I understand this is a classpath issue, so I took my classpath settings from my profile and loaded them in a script in Jenkins. I checked with echo $CLASSPATH and everything seems to return as expected.
    Only that does not solve the issue, I still get no module named wli error.

    Do you have any idea / pointers?


Comments are closed.

Next Post

Oracle SOA Suite 11g PS 5 introduces BPEL with conditional correlation for aggregation scenarios

Not too long ago, one of my customers had the following requirement: a file with invoice-entries has to be processed each night; for all invoice entries for the same customer, we would like to start a single BPEL process instance that aggregates the entries and creates a single invoice. To […]
%d bloggers like this: