June 25 2016

The Challenge

The Oracle 12.1.3 release provided Maven support and it generates project POMs for SOA, ADF and OSB quite nicely.  However, there is no out-of-the-box POM created for a project charged with deploying a Metadata Services archive (MAR) to SOA.   The solution is to use the Apache Assembly plugin to create the archive and then a SAR type deployment to target SOA.  The latter requires a large number of parameters be passed as Maven command line arguments and the deployment does not address targeting the MAR to different environments like QA and PROD.  

Earlier Adam DesJardin (AVIO CTO) blogged about a SAR parent POM that could instead be referenced to accept only one parameter on the Maven deployment which was a reference to a properties file that contains the name-value properties for a SOA deployment.  The idea is to create one of them for each of the environments (DEV, QA, CI, PROD).  This topic will show how to configure the MDS project POM to utilize the AVIO parent POM and add an Assembly plugin for use in the deployment to SOA. 

Maven Solution

Use the AVIO SAR parent POM but add the assembly plugin to create the MAR that will be deployed to SOA.  The assembly plugin is out-of-the-box Apache.  It references an assembly descriptor that contains project variable tokens that get substituted nicely by the Maven build.  Of course, it needs to be deployable and this blog will show you those steps to summarize.  

There are a couple of assumptions before you actually undertake the steps listed below.

  • You already have a functioning 12.1.3 or 12.2.1 FMW repository already set up.  If not you can at least peruse the steps below for future reference.
  • You have added the AVIO parent POM to your local Maven repository. If you have not please read SAR parent POM. Adam discusses downloading the AVIO parent Pom and covers the properties you'll need in the SAR project POM in his blog.
  • The FMW references as you will see are to 12.2.1.

The Steps

In this scenario there is a SOA application containing a project whose project source directory is "apps" and below it are the packages for the application.  Below is a sample of the apps folder structure in the MDS project.  Of course your structure will likely be different but the important thing is you have an apps folder. 



Step 1 - Create the POM for the MDS project and modify it to reference the AVIO SAR parent POM. 

     1. In JDeveloper add Maven to the MDS project by right-clicking the project and selecting (New...From Gallery).

     2. In the Gallery dialog select General...Maven...Maven POM for Project.

     3. JDeveloper will open the project POM.  Switch to the Source view and replace the parent element with the reference to the AVIO SAR parent POM.  


(If you haven't added the AVIO SAR parent POM to your local Maven repo you could "cheat" and reference it in the relativePath element above.)

    4. There will be one build plugin in the generated project POM for the oracle.soa.plugin.  The next step will have you add the assembly plugin just below it.


Step 2 - Add Maven Assembly Plugin

    1. Just above the </plugins> element add the following lines that reference a file you will create in the project directory.  

... (copy the above lines)

    Notice in the preceding XML the reference to "mar-assembly-descriptor.xml" and that the assembly plugin executes in the package phase.

    2. In JDeveloper create an XML file in the project directory named "mar-assembly-descriptor.xml" with the following contents.       

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" 

    3. Save the MAR assembly XML file.

Step 3 - Create Environment Properties

We are about to deploy the MAR but the properties file the AVIO SAR parent POM requires needs to be created.  

    1. Create an "env" sub-directory within your application directory.

    2. Create a file named "dev.properties" in the "env" sub-directory.

    3. Add the following name-value pairs shown below and customize for your environment.  (These properties are the same as those in Adam's blog.)


    4. Save the file as  "DEV.properties" in the env directory.

Step 4 - Deploy the MDS Archive to SOA

A little quirk is that you must set the "soamds.apps.home" environment variable for the Maven deployment to succeed.  This is relatively straight-forward in Windows, as shown below.  The key is the environment variable has to be the full path to where the "apps" directory is defined.  (This environment variable is used in the .adf/META-INF/adf-config.xml file.)

set soamds.apps.home=C:\app-directory\mds-project ... mvn pre-integration-test -Denv=DEV

On Linux and the Mac however there is apparently a dislike of environment variables with dots in the names.  You will have to include it in the Maven command line.  (Line break added on first line for readability.)

env 'soamds.apps.home=/home/greg/app-foler/mds-project/'  
    /opt/oracle/product/oracle_home/oracle_common/modules/org.apache.maven_3.0.5/bin/mvn pre-integration-test -Denv=dev


AVIO strongly encourages the use of parent POMs as a way to standardize your Fusion Middleware Maven deployments.  The AVIO SAR parent POM does that.  This blog hopefully combines that best practice with some fragments that should help to Maven-ize your MDS deployments.

About the Author

Greg Hughlett

Greg has more than twenty-five years of experience in all phases of design, development, and implementation of software applications.  He has developed and architected BPM/SOA technologies for more than ten of those years from Fuego BPM to BEA AquaLogic BPM to Oracle BPM/SOA 11g.  He has worked for clients within banking, financial services, Life Insurance,  Health Care, public sector and telecommunications industries.  His areas of expertise include Oracle SOA and Oracle BPM (formerly AquaLo

Join the Conversation

Enter your first name. It will only be used to display with your comment.
Enter your email. This will be used to validate you as a real user but will NOT be displayed with the comment.
By submitting this form, you accept the Mollom privacy policy.