mavenweblogicwlstoracle-service-bus

Is it possible to "clean" deploy Oracle service bus project to OSB using maven?


I need to be sure in clean maven deployment of a project. I mean not 'mvn clean deploy', but to remove existing project from OSB before deploying (overwriting). If you overwrite project on OSB, you can't be sure that all of its resources will be updated. I've seen a lot of cases when some resources in project are overwritten and some are not. It's quite unpredictable behavior. So the question is: is it some maven (maven service bus plugin or maybe some other one like maven weblogic) task or parameter to force update project before deploying?


Solution

  • Well, I found the solution. It is not straightforward. Actually I dont like it, but it works.

    The only solution I have found is to delete service (project in OSB terms) from OSB console using WLST. The working script I found in the Martien van den Akker's blog here: http://blog.darwin-it.nl/2014/03/osb-remove-artefacts-with-wlst.html

    It is ready to use script. But this works only for OSB 11 and doesnt work for OSB 12. So you can use this workaround: http://soamagic.blogspot.com/2016/05/osb-12c-java.html

    In my CI server (Hudson-based) I added Maven build step to launch sh-script, which executes wlst.sh with py-script as a parameter (actually there are 4+ parameters - weblogic admin username, password, url and others - project names to delete). This build step executes before every service deploy. This guarantees that the newest version of the service will be deployed to the OSB-server.

    Edit: Not sure if it worth posting, but I hope someone can find something useful in my code. So here it is:

    1. Maven build:

      <profile> <id>undeployService</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.5.0</version> <executions> <execution> <id>wlst-undeploy-service</id> <phase>process-resources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable> ${project.basedir}/../conf/WLST/undeployProject.sh </executable> <arguments> <argument> ${weblogic.username} </argument> <argument> ${weblogic.password} </argument> <argument> ${weblogic.url} </argument> <argument> ${project.artifactId} </argument> </arguments> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile>

    2. undeployProject.sh script:

    . ${MW_HOME}/osb/tools/configjar/setenv.sh ${MW_HOME}/osb/tools/configjar/wlst.sh ../conf/WLST/undeployProject.py $*