Friday 13 March 2015

12c SOA composite deployment using maven

Hi All,

Today I am going to share How we can deploy soa composite using Maven in 12c.Maven is newly introduces with Soa in 12c and this blogs might helps you get to know Soa maven little bit.

For getting started with deployment you need to Setup Environment for maven in you local Enviorment.

I am not sure if I am missing anything here. Please suggest.

inti.cmd:

SET JAVA_HOME=D:\12c-Installation-Path\Java\jdk1.7.0_60
SET ANT_HOME=D:\12c-Installation-Path\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.ant_1.9.2
SET M2_HOME=D:\12c-Installation- 
(I would suggest for Maven please download Maven 3.2.5.zip from http://maven.apache.org/download.cgi)

Path\Oracle\Middleware\Oracle_Home\oracle_common\modules\org.apache.maven_3.0.5
SET PATH=%PATH%;%JAVA_HOME%\bin;%M2_HOME%\bin;%ANT_HOME%\bin

After Setting up above properties in Enviorment Just open then cmd prompt run as adminstrator and 

#mvn -version

get confrontation maven class-path set and working fine. 

Next step is to populate all the maven repositories

cd  .../oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3

install the maven sync plugin to the local repository

mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -DoracleHome=/Users/edwin/Oracle/JDevMiddleware12.1.3

Deploy all the libraries to the local mvn repository

mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=/Users/edwin/Oracle/JDevMiddleware12.1.3

update your local archetype catalog

mvn archetype:crawl -Dcatalog=$HOME/.m2/archetype-catalog.xml

Next steps are, to do the same but then we will fill the Nexus repository

Deploy the maven sync plugin to the nexus maven repository and we need to configure the maven settings.xml(its optional upto you).

mvn deploy:deploy-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty -DrepositoryId=internal

and do a another sync

mvn com.oracle.maven:oracle-maven-sync:push

Once you Done with All setups and configuration.Lets start with Soa Composite Deployments.

1.Create Soa Application File>NewApp>..
2.Create Project.
Finish

Open the Structure you will notice that there is Two Pom.xml one is at Applicatoin Level and other one is at project Level.In jdev You can See project pom under Resource folder and Application one under ApplicationRsources > Build

If you open the pom you will notice Structure

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- The Basics -->
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <version>...</version>
  <packaging>...</packaging>
  <dependencies>...</dependencies>
  <parent>...</parent>
  <dependencyManagement>...</dependencyManagement>
  <modules>...</modules>
  <properties>...</properties>

  <!-- Build Settings -->
  <build>...</build>
  <reporting>...</reporting>

  <!-- More Project Information -->
  <name>...</name>
  <description>...</description>
  <url>...</url>I 
  <organization>...</organization>
  <developers>...</developers>
  <contributors>...</contributors>

  <!-- Environment Settings -->
  <issueManagement>...</issueManagement>
  <ciManagement>...</ciManagement>
  <mailingLists>...</mailingLists>
  <scm>...</scm>
  <prerequisites>...</prerequisites>
  <repositories>...</repositories>
  <pluginRepositories>...</pluginRepositories>
  <distributionManagement>...</distributionManagement>
  <profiles>...</profiles>
</project>



I will just Discuss Bisics about Pom in this Blog.

The Basics

The POM contains all necessary information about a project, as well as configurations of plugins to be used during the build process. It is, effectively, the declarative manifestation of the "who", "what", and "where", while the build lifecycle is the "when" and "how". That is not to say that the POM cannot affect the flow of the lifecycle - it can. For example, by configuring the maven-antrun-plugin, one can effectively embed ant tasks inside of the POM. It is ultimately a declaration, however. Where as a build.xml tells ant precisely what to do when it is run (procedural), a POM states its configuration (declarative). If some external force causes the lifecycle to skip the ant plugin execution, it will not stop the plugins that are executed from doing their magic. This is unlike a build.xml file, where tasks are almost always dependant on the lines executed before it.
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.codehaus.mojo</groupId>
  <artifactId>my-project</artifactId>
  <version>1.0</version> 
</project> 


Maven Hierarchy  .
root
|-- parent-pom
|   |-- branches
|   |-- tags
|   `-- trunk
|       `-- pom.xml
`-- projectA
    |-- branches
    |-- tags
    `-- trunk
        |-- module1
        |   `-- pom.xml
        |-- moduleN
        |   `-- pom.xml
        `-- pom.xml


Lets come Back And See how you can find you Poms's in :-


Jdev generate you pom.xml so its to easy no need to get more worried you just need to difene your properties.under property tag.


Open you project Pom.and Define you serverUrl and user Name etc. 

<properties>
        <!-- These parameters are used by the compile goal -->
        <scac.input.dir>${project.basedir}\SOA/</scac.input.dir>
        <scac.output.dir>${project.basedir}/target</scac.output.dir>
        <scac.input>${scac.input.dir}/composite.xml</scac.input>
        <scac.output>${scac.output.dir}/out.xml</scac.output>
        <scac.error>${scac.output.dir}/error.txt</scac.error>
        <scac.displayLevel>1</scac.displayLevel>
        <!-- if you are using a config plan, uncomment the following line and update to point
             to your config plan -->
        <!--<configplan>${scac.input.dir}/configplan.xml</configplan>-->
     
        <!-- These parameters are used by the deploy and undeploy goals -->
        <composite.name>${project.artifactId}</composite.name>
        <composite.revision>1.0</composite.revision>
        <composite.partition>default</composite.partition>      
        <serverUrl>http://192.168.137.150:7003</serverUrl>      
        <user>weblogic</user>
        <password>Oracle123</password>
        <overwrite>true</overwrite>
        <forceDefault>flase</forceDefault>
        <regenerateRulebase>false</regenerateRulebase>
        <keepInstancesOnRedeploy>false</keepInstancesOnRedeploy>
     
        <!-- These parameters are used by the test goal
         if you are using the sca-test (test) goal, you need to uncomment the following
             line and point it to your jndi.properties file. -->
           
        <!--<jndi.properties.input>UNDEFINED</jndi.properties.input>-->
        <scatest.result>${scac.output.dir}/testResult</scatest.result>
        <!--  input is the name of the composite to run test suties against -->
        <input>${project.artifactId}</input>
     
        <!--<scac.ant.buildfile>${env.MW_HOME}/soa/bin/ant-sca-compile.xml</scac.ant.buildfile>
        <sca.ant.testfile>${env.MW_HOME}/soa/bin/ant-sca-test.xml</sca.ant.testfile>
        -->
     
    </properties>



Now You can  Deploy you Composite:-





>Open cmd promt go to your application dir.

Run #
 mvn pre-integration-test

It will build and deploy you composite.

Hope you have happy deployment.

No comments:

Post a Comment