In this blogpost I will show you first, how to do this in a shell script with I run on a linux server and the second part how to do the same with maven.
all demo code is available at github and contains a demo OSB workspace.
First step is to create an configuration setting xml with will be used by the configjar utility
here is an example of a OSB workspace configuration file with all its project and resources
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/ReliableMessageWS"/> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/XSDvalidation"/> <system dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/OSB Configuration"/> </source> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-resources.jar"> <projectLevel includeSystem="true"/> </configjar> </configjarSettings>
and in this case only one project and an separate export for particular system resource
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/ReliableMessageWS"/> <system dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/OSB Configuration"/> </source> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-rel.jar"> <projectLevel includeSystem="false"/> </configjar> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-rel-system.jar"> <resourceLevel> <resources> <include name="**/*.jndi"/> </resources> </resourceLevel> </configjar> </configjarSettings>
To see all the possible options see this Oracle document page
Next step is to use this setting xml in our shell script.
That's all, this will generate the sbconfig jars but we can also do the same with maven.
The rest of the blog will describe the maven build and deploy.
First we also need to have a setting xml which will be used by maven. The OSB setting file does not support environment variables so I need to use the com.google.code.maven-replacer-plugin maven plugin to replace the tokens.
This is the workspace setting xml ( located in the OSB workspace folder)
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="$WORKSPACE_HOME$/ReliableMessageWS"/> <project dir="$WORKSPACE_HOME$/XSDvalidation"/> <system dir="$WORKSPACE_HOME$/OSB Configuration"/> </source> <configjar jar="$BUILDDIR$/$ARTIFACTID$-$VERSION$.jar"> <projectLevel includeSystem="$OSBINCLUDESYSTEM$"/> </configjar> </configjarSettings>
This is de project setting xml ( located in the OSB project folder)
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="$WORKSPACE_HOME$/ReliableMessageWS"/> <system dir="$WORKSPACE_HOME$/OSB Configuration"/> </source> <configjar jar="$BUILDDIR$/$ARTIFACTID$-$VERSION$.jar"> <projectLevel includeSystem="$OSBINCLUDESYSTEM$"/> </configjar> </configjarSettings>
The workspace pom ( located in the OSB workspace folder) , where the path to parent pom is different and the target folder
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>biemond.core.osb</groupId> <artifactId>tool</artifactId> <version>1.0</version> <relativePath>../parent/pom.xml</relativePath> </parent> <groupId>biemond</groupId> <artifactId>osb.source</artifactId> <version>1.5.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <buildDirectory>${project.basedir}/../target</buildDirectory> <buildOsbBase>${project.basedir}/../</buildOsbBase> <osbProjectBase>${project.basedir}</osbProjectBase> <osbIncludeSystem>true</osbIncludeSystem> </properties> <scm> <connection>scm:git:git@github.com:biemond/soa_tools.git</connection> <developerConnection>scm:git:git@github.com:biemond/soa_tools.git</developerConnection> <url>https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6_tool</url> <tag>osb.source-1.3.3</tag> </scm> </project>
The OSB project pom ( located in the OSB project folder) , this one is level deeper then the workspace pom.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>biemond.core.osb</groupId> <artifactId>tool</artifactId> <version>1.0</version> <relativePath>../../parent/pom.xml</relativePath> </parent> <groupId>biemond</groupId> <artifactId>osb.source.reliablemessagews</artifactId> <version>1.4.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <buildDirectory>${project.basedir}/../../target</buildDirectory> <buildOsbBase>${project.basedir}/../../</buildOsbBase> <osbProjectBase>${project.basedir}/../</osbProjectBase> <osbIncludeSystem>true</osbIncludeSystem> </properties> <scm> <connection>scm:git:git@github.com:biemond/soa_tools.git</connection> <developerConnection>scm:git:git@github.com:biemond/soa_tools.git</developerConnection> <url>https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6_tool</url> <tag>HEAD</tag> </scm> </project>
Here is the parent pom with the prepare package phase to replace the tokens in the osb setting file, package for making a sbconfig jar and the deploy phase which use the WLST import.py script to deploy it to the server.
Last step is to add some variables to the maven settings.xml, which contains all the WebLogic and OSB variables
At last we can generate some artifacts.
. osb.sh ( sets maven, java environment variables )
mvn package, builds all or 1 project depends on the location in the source folder ( OEPE Workspace )
mvn deploy -Dtarget-env=dev-osb, deploy to the dev OSB server
mvn release:prepare, prepare a release
mvn release:perform -Dtarget-env=dev-osb -DconnectionUrl=scm:git:git@github.com:biemond/soa_tools.git
Here is the url of the demo workspace on github