Saturday, 27 December 2014

Maven Set up in JDeveloper 12C

Maven Set up in JDeveloper 12C

Prerequisites : First we should install JDK 1.7 and JDeveloper 12.1.3.0.0

Step1: open cmd prompt

Step2: set environment variables in cmd prompt
        set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_25
        set PATH=%JAVA_HOME%\bin;%PATH%
        set ORACLE_HOME=D:\Fusion12C\Oracle\Middleware\Oracle_Home
        set M2_HOME=<ORACLE_HOME>\oracle_common\modules\org.apache.maven_3.0.5
        set PATH=%M2_HOME%\bin;%PATH%
NOTE: set the variables as per your machine.

Step3: Now we need a way to get the necessary artifacts into developers machines local Maven repository. Oracle provides the Maven Synchronization plug-in for this. So now we need install the plugin to local maven repository by using below MVN cmd.

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

NOTE:
"oracle-maven-sync-12.1.3.jar" and "oracle-maven-sync-12.1.3.pom" are available in below location.
These two files comes with JDev12c installation at below location.
%ORACLE_HOME%/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3/



Step4: Next step is to execute the plugin in order to import the Oracle Maven artifacts, including the Parent POM necessary for deploying our SOA composite.

mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=D:/Fusion12C/Oracle/Middleware/Oracle_Home



NOTE: After completing execution of above command now we can see Parent POM in below location.
C:\Users\Fusion\.m2\repository\com\oracle\soa\orabpel\12.1.3-0-0
Parent POM file Name : orabpel-12.1.3-0-0.pom
we can use this file as parent for all pom.xml files which created along with SOA 12c projects.
In this file we can store global parameters like deployment server, user and password. Of-course we can discuss this in my next post.



Thats it, now maven is ready in your machine to execute MVN cmd's.

Maven Life cycle:
--> mvn validate
Ensure that the project is correct and all necessary information is available.
--> mvn compile
Compile the source of the project
--> mvn test
Test the compiled source code using a suitable unit testing framework; tests should not require the code to be packaged or deployed.
--> mvn package
Take the compiled code and package it in its distributable format, such as a JAR, WAR, EAR, SAR, or GAR files.
--> mvn integration-test
Process and deploy the package, if necessary, into an environment where integration tests can be run.
--> mvn verify
Run checks to verify whether the package is valid and meets quality criteria.
--> mvn install
Install the package into the local repository for use as a dependency in other projects locally.
--> mvn deploy
For the final release, copy the final package to a remote repository for sharing with other developers and projects.

By using mvn we can execute maven archetypes like below.
--> mvn archetype:generate
To create a SOA application and SOA Project with required SOA package structures and ID's.
--> mvn pre-integration-test
To deploy all soa projects in SOA application.

Few more maven goals and archetypes are available, we can discuss them in my next post.







No comments:

Post a Comment