Tuesday, August 27, 2013

Deploy war to WebLogic using Maven

First off you need Maven and Weblogic setup in your computer to start this tutorial.
My Weblogic(10.3.6.0) has setup under : C:\Oracle\Middleware.

Set Middleware home :
 
set MW_HOME=C:\Oracle\Middleware

1. Build the plug-in JAR file using the WebLogic JarBuilder Tool (wljarbuilder) under %MW_HOME%/wlserver_10.3/server/lib/ with the following command:
 
java -jar wljarbuilder.jar -profile weblogic-maven-plugin
The weblogic-maven-plugin.jar contains a Project Object Model (pom.xml) file which specifies the groupId, artifactId, version, and packaging of the weblogic-maven-plugin.jar:
 groupId=com.oracle.weblogic
artifactId=weblogic-maven-plugin
version=10.3.6.0
packaging=maven-plugin

2. Extract the pom.xml file from weblogic-maven-plugin.jar under the %MW_HOME% wlserver_10.3/server/lib directory, and then copy the pom.xml file to %MW_HOME%/wlserver_10.3/server/lib.
 
jar xvf %MW_HOME%/wlserver_10.3/server/lib/weblogic-maven-plugin.jar META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml


copy %MW_HOME%/wlserver_10.3/server/lib/META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml  to %MW_HOME%//wlserver_10.3/server/lib/pom.xml

Add following in your project pom.xml file:


3.Provision the weblogic-maven-plugin.jar in your local Maven repository with the following command. However, for a shortened command-line goal invocation of the plug-in, follow the directions in next step 4 before performing this step.
http://docs.oracle.com/cd/E21764_01/web.1111/e13702/maven_deployer.htm
 
mvn install:install-file -Dfile=%MW_HOME%/wlserver_10.3/server/lib/weblogic-maven-plugin.jar -DpomFile=pom.xml



4.
  you can shorten the full invocation of the plug-in by providing a pom.xml file  and modifying the settings.xml file located in your $HOME/.m2 directory, before you provision the plug-in in your Maven repository
  1. Change the settings.xml file as follows:
    
    
    
       
       com.oracle.weblogic
     

 b. Replace the %MW_HOME%/wlserver_10.3/server/lib/pom.xml file with the following(Use same version that was in the pom.xml):




  4.0.0
  com.oracle.weblogic
  weblogic-maven-plugin
  maven-plugin
  10.3.4
  Maven Mojo Archetype
  http://maven.apache.org
  
    
      org.apache.maven
      maven-plugin-api
      2.0
    
  
 
  
   
      
       maven-plugin-plugin
       2.3
       
         weblogic
       
      
    
  
 


From within MW_HOME/wlserver_10.3/server/lib/, run the mvn install command.

mvn install

From within MW_HOME/wlserver_10.3/server/lib/, provision the weblogic-maven-plugin.jar in your local Maven repository as follows:

mvn install:install-file -Dfile=%MW_HOME%/wlserver_10.3/server/lib/weblogic-maven-plugin.jar -DpomFile=pom.xml

Now, you can use a shortened command-line goal invocation, such as:

mvn weblogic:deploy

Deployment Goals
weblogic.deploy
weblogic:undeploy
weblogic:redeploy
weblogic:start-app
weblogic:stop-app
weblogic:list-apps
weblogic:update-app
weblogic:help


  

Do you like this post? Please link back to this article by copying one of the codes below.

URL: HTML link code: BB (forum) link code:

No comments:

Post a Comment