Creating SOA Applications using Maven

In this post, let’s look at how to create a SOA/BPM application from a Maven archetype.

This is fairly simple to do – we just need to use the standard Maven archetype:generate goal and identify the SOA archetype we want to use.

There are two archetypes provided for SOA:

    This one creates a SOA Application which contains one SOA Project.  This is the equivalent of going into JDeveloper and doing File/New/Application…/SOA Application.
    This one creates a new SOA Project – it assumes that you will run it inside an existing SOA Application that you want to add another SOA Project to.  This is the equivalent of opening a SOA application in JDeveloper and then doing File/New/Project…/SOA Project.

So let’s create a new SOA Application.  Two notes on this command – first, you need to type it all on one line, or add continuation characters, and second – the archetypeRepository=local is optional – that just tells Maven not to bother looking in remote repositories for the archetype.  If you leave that out, it will just take a little longer for the command to run while Maven checks for the archetype in Maven Central and any other repositories you have defined in your Maven settings.xml.

mvn archetype:generate

You can also specify the remaining properties on the command line if you want to.  In this example, we will just let Maven prompt us for them, as you see below.  These are all the standard Maven properties that you would get prompted for on any archetype, except for projectName – that one is used to set the name of the SOA Project.  You should make that different to the name of the SOA Application – otherwise the Maven coordinates will clash.

[INFO] Generating project in Interactive mode
[INFO] Archetype defined by properties
Define value for property 'groupId': : com.redstack
Define value for property 'artifactId': : soaApp1
Define value for property 'version':  1.0-SNAPSHOT: :
Define value for property 'package':  com.redstack: :
[INFO] Using property: adf = .adf
[INFO] Using property: data = .data
Define value for property 'projectName': : soaProject1
Confirm properties configuration:
groupId: com.redstack
artifactId: soaApp1
version: 1.0-SNAPSHOT
package: com.redstack
adf: .adf
data: .data
projectName: soaProject1
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: oracle-soa-application:12.1.3-0-0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.redstack
[INFO] Parameter: artifactId, Value: soaApp1
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.redstack
[INFO] Parameter: packageInPathFormat, Value: com/redstack
[INFO] Parameter: package, Value: com.redstack
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: projectName, Value: soaProject1
[INFO] Parameter: groupId, Value: com.redstack
[INFO] Parameter: adf, Value: .adf
[INFO] Parameter: data, Value: .data
[INFO] Parameter: artifactId, Value: soaApp1
[WARNING] Don't override file C:\src2\soaApp1\pom.xml
[WARNING] Don't override file C:\src2\soaApp1\src\META-INF
[WARNING] Don't override file C:\src2\soaApp1\src\META-INF\jps-config.xml
[WARNING] Don't override file C:\src2\soaApp1\.adf\META-INF
[WARNING] Don't override file C:\src2\soaApp1\.adf\META-INF\adf-config.xml
[INFO] project created from Archetype in dir: C:\src2\soaApp1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.386 s
[INFO] Finished at: 2014-07-10T07:01:28+10:00
[INFO] Final Memory: 11M/298M
[INFO] ------------------------------------------------------------------------

Now you can take a look in that new soaApp1 directory and you will see a new, empty SOA Application – exactly the same set of files and directories you get when you create a new SOA Application in JDeveloper.

Just for fun, you could go ahead and build a SAR by running:

mvn package

Of course, that SAR wont be terribly interesting because we have not added any SCA components to our composite yet, but nonetheless you will be able to deploy it if you want to.  You will find the SAR in soaProject1/target (assuming you used the same names as I did).

Editing our Application in JDeveloper

Let’s open up our new application in JDeveloper and add a BPEL process to it!

In JDeveloper, select File/Import…/Maven Project.  In the dialog box that appears, type in the location where your new application is located, and click on the Refresh button.


Tick the boxes for the POMs (as shown above) and click on OK.  The Create Application dialog box will appear.  Put in the same name and parent directory location (as shown below) and JDeveloper will create the JWS file right in the same directory.  If you prefer, you can let JDeveloper copy the application to some other location – if you want to do this, make sure you tick the box next to Also import source files into application in the Import Maven Projects dialog box.


When you click on OK, JDeveloper will ask you to confirm you want to overwrite the application.  Click on Yes.  Don’t worry – it wont really overwrite anything, it will just go and add the JWS and JPR files.


Your new application will open in JDeveloper:


Now we are ready to add something to the application.  Let’s just add a simple BPEL “echo” process.  I am going to assume you are familiar with this, so here are the high level steps:

  • Double click on the soaProject1 composite to open it in the editor.
  • Drag a BPEL Process from the Components pane on to the composite.
  • Give it a name, etc.
  • Save.
  • Double click on the new BPEL process to edit it.
  • Drag an Assign activity out and drop it between the receiveInput and the callbackClient activities.
  • Double click on the Assign activity and add a new copy rule to copy the input to the output.
  • Save.

Now we have something we can deploy and look at.

At this point, you want to set up the POM with the details for your test server.  You might want to use the embedded server in JDeveloper, or maybe you have a separate server to use.


Go ahead and open the pom.xml file in soaProject1 and switch to the Source view.

Here are the properties you will want to update to match your environment:


While you are there, you might notice a few other useful properties you might want later on:


Now save the POM.

We can now deploy our composite to the server using Maven.  This can be done right in JDeveloper, or from the command line.

Deploying from JDeveloper (using Maven)

The Maven goal we want to use is pre-integration-test.  This is not shown in the JDeveloper popup menu by default, so let’s go add it in.  (This is a one time operation)  We are going to want to use verify as well (later on) so let’s add it in to.

Right click on the POM, then select Manage Goal Profiles…  In the dialog box (shown below) highligt verify and click on the little blue right arrow to add it to the selected list on the right.  Then add pre-integration-test as well.  Then click OK.


With that done, now we can right click on the POM and select Run Maven Goal Profile “Default” and then pre-integration-test.

Deploying from the command line

To deploy from the command line, we just go to the application directory and run:

mvn pre-integration-test

Either way, you will get your composite deployed.  You can go log on to FMW Control/Enterprise Manager and have a look at it.


In the next post, lets add some SCA Tests and see how we can execute them with Maven.

About Mark Nelson

Mark Nelson is a Developer Evangelist at Oracle, focusing on microservices and messaging. Before this role, Mark was an Architect in the Enterprise Cloud-Native Java Team, the Verrazzano Enterprise Container Platform project, worked on Wercker, WebLogic and was a senior member of the A-Team since 2010, and worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994.
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s