SOA Suite 12C: Add version information to your ServiceBus projects using custom maven plugin

As you have seen in my previous posts it is possible to build your SB and SOA components using Maven. See here. One of the issues we encountered is that building ServiceBus projects supports some very basic maven stuff. For example the description property in the maven pom file is not mapped to the description field of a service bus project which would have been nice as this is the only extra field which we can use to put some extra information….for example version info!

For SOA composites you are able to input some versioning info by updating the composite.xml using a Google maven plugin. Just add this plugin to build:



	com.google.code.maven-replacer-plugin
	replacer
	1.5.3
	
		
			initialize
			
				replace
			                   
		
	
	
		true
		${scac.input}
		//composite/@revision
		^.*$
		${composite.revision}
	

which result into:
versioningSoa

For SB projects there is no such thing. How can we then see which version we have?! Well the only field which we can use is the description field. The only problem is that you can not update this using Maven. The things you have to:

  • Unzip the sbconfig.sbar
  • Update the _projectdata.LocationData file which holds a proj:description tag
  • Zip the sbconfig.sbar again

Not too difficult at all. You probably can do this by using Ant but that is so 2001! We have Maven now so why not write a custom Maven plugin which does this all for you?! Well I won’t bother you with the Java details but you can download the plugin jar here or just get the code from https://github.com/hugohendriks1978/osb-project-description-plugin!

–Updated–

Rutger Saalmink pointed me at a bug. It seems the Oracle Maven Plugin truncates the projectname if it is longer then 40 characters. When looking up the project sbar, it would fail as the filename wouldn’t match. Rutger fixed it and I updated the code. So here is a new version.version-information-plugin-1.1.jar

–Updated–

Just install it into your Maven repository by running:

    mvn install:install-file -Dfile=version-information-plugin-1.1.jar -DgroupId=nl.redrock.maven.plugins.servicebus -DartifactId=version-information-plugin -Dversion=1.1 -Dpackaging=jar

Now that you have the plugin installed you can wire it to the package phase of your service bus project by adding the plugin to your service bus pom file. Mine looks like this:



  4.0.0
  
    com.oracle.servicebus
    sbar-project-common
    12.1.3-0-0
  
  nl.redrock
  ConversionRateService
  1.1.2.5
  sbar
  
  
    
     
        nl.redrock.maven.plugins.servicebus
        version-information-plugin
        1.0
        
          
            package
            
              version
            
          
        
        
          ${project.version}
        
      
    
  

This will now call the plugin after the normal packaging has been completed. In the configuration you can now set the description. In my case I fill it with the versioning info of the component itself. Now just build your service bus project using Maven:

mavenbuild

and deploy and go to the sbconsole and voila:

sbconsole

4 Replies to “SOA Suite 12C: Add version information to your ServiceBus projects using custom maven plugin”

  1. Pingback: Using JMX to list installed 12C OSB and SOA projects including versions using Java

  2. Hello,
    Very nice trick. I would like to ask about a “Desrciption” field. I know that it could be edited in web-console (sbconsole), but is the possibility to edit this field in JDeveloper (version 12.1.3)?

    Best regards
    Grzegorz

    • Hi, no unfortunately you can’t edit this in JDev(12.1.3) only in the sbconsole. I guess that this also isn’t included in newer versions as Oracle focusses completely on Cloud.

  3. Pingback: List installed 12C OSB and SOA projects including versions using Java

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.