Sunday, 24 July 2016

Build and Deployment using Maven

In most of client organizations I see Maven is the official tool for deployment as part of their standard build and deployment tool. Oracle BPM supports maven based build and deployment. In fact it provides out-of-box capability to add application level and project level pom in Jdeveloper.

Before adding pom for the BPM application and BPM projects in JDeveloper, the local maven repository should be configured. Below the steps to configure the local maven repository.


Setting up Maven local repository

Step 1 : you can use the maven binary distributed with Oracle BPM 12C (12.2.1) or can download apache maven. Set the path variable to include maven bin folder-

In mac os following is the command to set the path of variable -
export PATH=$PATH:/Users/ctsuser/Oracle/Middleware12c/Oracle_Home/oracle_common/modules/org.apache.maven_3.2.5/bin

Step 2: Before running maven:install to setup the local repository, you may need to configure the proxy so that maven can download the dependent libraries from central repository. The global maven configuration file is located at -

/Users/ctsuser/Oracle/Middleware12c/Oracle_Home/oracle_common/modules/org.apache.maven_3.2.5/conf/settings.xml

Step 3: to execute the install and crawl, you need to use JDK 1.7, it does not work with JDK 1.8.
In mac os, following is the command to set the JAVA_HOME environment variable. 

export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.7.0_49.jdk/Contents/Home’ 

After the variable is set, make sure your jdk is pointing to desired version 

java - version

Step 4: You need to install soa plugins. 
Goto 
/Users/ctsuser/Oracle/Middleware12c/Oracle_Home/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.2.1

Execute 
mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar 

Step 5: Next you need to run the ‘Push’ Command to upload all the Oracle Maven artifacts to local repository.

mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/Users/ctsuser/Oracle/Middleware12c/Oracle_Home -X -DpushDuplicates=true

Step 6: To ensure that all artifacts are in order, execute the crawl

mvn archetype:crawl -Dcatalog=/Users/ctsuser/.m2/archetype-catalog.xml

/Users/ctsuser/.m2/ is the local repository in my case.

Ok. by now you have the local maven repository setup with Oracle soa artifacts.

Adding Maven support to BPM Application in JDeveloper

Next we will add the pom in our existing BPM application and BPM projects in JDeveloper. Steps as follows - 

Step 1: Select the application and choose Add New From Gallery > Select Application POM (Maven )


Enter the GroupId, Artifact ID and click OK.


For each projects select Add New From Gallery and choose Maven POM for Project(Maven)


Enter the GroupId, Artifact ID and click OK.


Edit the Application and Project level POM (pom.xml)



Running Maven for Deployment


Make sure you have maven in the path

export PATH=$PATH:/Users/ctsuser/Oracle/Middleware12c/Oracle_Home/oracle_common/modules/org.apache.maven_3.2.5/bin

Make sure ORACLE_HOME is set
export ORACLE_HOME='/Users/ctsuser/Oracle/Middleware12c/Oracle_Home/‘

Make sure JAVA_HOME points to jdk 1.8


export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home’

Change the server connection details in pom
<serverUrl>
      http://localhost:7001
    </serverUrl>
<user>
      weblogic
</user>
<password>
      password
</password>

Execute the command 

mvn install -X -Dmaven.test.failure.ignore=true

Note: It is always good to use configuration plan for deployment of composite to different environments ( DEV, SIT, QA, Prod env). You can generate the deployment plan by right clicking over the composite file and clicking on the menu option "Generate Configuration Plan". To include the configuration plan set the <configplan> property in the pom as follows -

<configplan>${scac.input.dir}/configplan.xml</configplan>




No comments:

Post a Comment