In two previous posts here and here, I demonstrated how you can setup CI for OFM 12C projects. One of the things I hadn’t figured out yet was how I could deploy the MDS using Maven. After a vague hint on the internet, Oracle’s response that this feature wasn’t officially supported yet and some trial and error I came across the solution. It is actually quite simple.
Basically it comes down to this:
- Create a zip file of the files you want to stick into the MDS
- Use the com.oracle.soa.plugin:oracle-soa-plugin:deploy maven goal to deploy it
That wasn’t that hard as you can see 🙂 Let’s go into a bit more detail. You can use a command line to create the zip or use the maven-assembly-plugin to give you a bit more flexibility. I used the last option because I wanted to filter certain files. Within my Jenkins job, I checked out my MDS files and zipped them using the package goal into a file called sca-MDS_rev1.0.jar. Look in the plugin section in the pom file down below to see about the configuration of the assembly plugin. The pom file is just a copy of a normal soa composite project.
4.0.0 nl.cvgz MDS 1.0 sar com.oracle.soa sar-common 12.1.3-0-0 ${project.basedir}\SOA/ ${project.basedir}/target ${scac.input.dir}/composite.xml ${scac.output.dir}/out.xml ${scac.output.dir}/error.txt 1 ${project.artifactId} ${project.version} default ${oracleServerUrl} ${oracleUsername} ${oraclePassword} true true false false ${scac.output.dir}/testResult ${project.artifactId}com.oracle.soa.plugin oracle-soa-plugin 12.1.3-0-0 ${project.artifactId} ${scac.input} ${scac.output.dir}/sca-${project.artifactId}_rev${composite.revision}.jar ${serverUrl} ${user} ${password} ${composite.revision} ${composite.revision} ${scac.input.dir} ${input}true maven-assembly-plugin 2.4.1 sca zip-assembly-descriptor.xml make-assembly package single
Here is the zip-assembly-descriptor.xml
MDS_rev1.0 / jar ../../../GedeeldeObjecten/apps / services/** dvm/**
As you can see I create a jar which includes my services and dvm directory. One thing to take in account is that you don’t need an apps directory in the zip. At first I created an apps directory as a top directory but when I deployed this, my MDS had a apps/apps structure so I removed this. My sca-MDS_rev1.0.jar has the following structure:
-dvm -MyDVM.dvm -services -HelloService_1.0 -HelloService_1.0.xsd -HelloService_1.0.wsdl
The only now left to do is to point the
When you run the com.oracle.soa.plugin:oracle-soa-plugin:deploy goal, maven will deploy you MDS jar like this:
[INFO] --- maven-assembly-plugin:2.4.1:single (make-assembly) @ MDS --- [INFO] Reading assembly descriptor: zip-assembly-descriptor.xml [INFO] Building jar: D:\tomcatfiles\.jenkins\jobs\SOA - MDS\workspace\MDS\soa\MDS\target\sca-MDS_rev1.0.jar [INFO] [INFO] --- oracle-soa-plugin:12.1.3-0-0:deploy (default-cli) @ MDS --- [INFO] ------------------------------------------------------------------------ [INFO] ORACLE SOA MAVEN PLUGIN - DEPLOY COMPOSITE [INFO] ------------------------------------------------------------------------ [INFO] [INFO] setting user/password..., user=weblogic Processing sar=D:\tomcatfiles\.jenkins\jobs\SOA - MDS\workspace\MDS\soa\MDS/target/sca-MDS_rev1.0.jar Adding shared data file - D:\tomcatfiles\.jenkins\jobs\SOA - MDS\workspace\MDS\soa\MDS\target\sca-MDS_rev1.0.jar INFO: Creating HTTP connection to host:MY_SERVER, port:7010 INFO: Received HTTP response from the server, response code=200 ---->Deploying composite success. [JENKINS] Archiving disabled [JENKINS] Archiving disabled[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.313 s [INFO] Finished at: 2015-05-23T02:59:22+02:00 [INFO] Final Memory: 36M/360M [INFO] ------------------------------------------------------------------------ [workspace] $ cmd /c call D:\ProgramFiles\Apache\Tomcat8.0\temp\hudson4288153212971789360.bat channel stopped
Pingback: SOA & BPM Community Newsletter June 2015 | SOA Community Blog
Pingback: Fusion Middleware 12C: Deploy the MDS using Maven by Hugo Hendriks | SOA Community Blog
This step is not clear. could you please explain
${scac.output.dir}/sca-${project.artifactId}_rev${composite.revision}.jar in the pom to the right location where your jar file is located.
If you look at the properties in the pom file, you can see that scac.output.dir equals ${project.basedir}/target. So it basically points to the target directory where your compiled jar has to be created. Next you have to define a name for the jar. That is done by stating sca-${project.artifactId}_rev${composite.revision}.jar. This creates a name sca-MDS_rev1.0.jar in my case as my project.artifactId = MDS and composite.revision = 1.0.
Hi Hugo,
Is there any way to verify this deployed MDS jar.
If possible can you share the video of this blog, because i followed the same steps with success response, but i am not able to see the MDS artifacts in my local host. Here are the steps i followed
1. create an empty soa project
2. generate the maven – project pom.xml
3. modify the project pom by adding the maven-assembly-plugin
4.created a new file zip-assembly-descriptor.xml in the same place of pom.xml
5. now ran the mvn package from the project directory which creates the Jar file
6. ran the “mvn oracle-soa:deploy -DoracleServerUrl=http://localhost:8101 -Duser=Weblogic -Dpassword=welcome1 -DsarLocation=target/sca-MDS_rev1.0.jar” for which build is shown success
But when i try to export the MDS to verify this in my local host its been errored out.
THanks,
Kumar
Hi Kunmar,
Not really I guess. If your deployment was successful that should mean the MDS was updated. The only way to check is to export the MDS in Enterprise Manager and have a look in the zip file. See https://khassoablog.wordpress.com/2016/04/23/how-to-export-and-import-mds-metadata-in-soa-suite-12c/ . What you can also do is to connect to it using jdeveloper. See http://blog.thisisahmed.com/2010/10/creating-mds-connection-through.html. Once you have established connection you should be able to browse the MDS of the server there.
regards,
Hugo