This article shows how to use a Maven plug-in for WebLogic Server (weblogic-maven-plugin) to perform deployment operations similar to those supported by the command-line utility, weblogic.Deployer. The plug-in lets you deploy, redeploy, update, and such, applications built using Maven to WebLogic Server from within the Maven environment.

Configuring the WebLogic Maven Plug-In

Follow these steps for generating, installing, and using the weblogic-maven-plugin:

1. Move under MW_HOME/wlserver_10.3/server/lib/

2. Build the plug-in JAR file using the WebLogic JarBuilder Tool (wljarbuilder) with the following command:

java -jar wljarbuilder.jar -profile weblogic-maven-plugin

3. Extract the pom.xml file from weblogic-maven-plugin.jar

jar xvf ./weblogic-maven-plugin.jar META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml

cp ./META-INF/maven/com.oracle.weblogic/weblogic-maven-plugin/pom.xml .

4. Change the settings.xml file (located in your $HOME/.m2 directory) as follows:

<settings>
  ...
  <pluginGroups>
    ...
    <pluginGroup>com.oracle.weblogic</pluginGroup>
  </pluginGroups>
</settings>

5. Add the following lines to the MW_HOME/wlserver_10.3/server/lib/pom.xml file:

<project>
  ...
 
  <build>
   <plugins>
      <plugin>
       <artifactId>maven-plugin-plugin</artifactId>
       <version>2.3</version>
       <configuration>
         <goalPrefix>weblogic</goalPrefix>
       </configuration>
      </plugin>
    </plugins>
  </build>
 
</project>

6. Run the mvn install command:

mvn install

7. Provision the weblogic-maven-plugin.jar in your local Maven repository as follows:

mvn install:install-file -Dfile=./weblogic-maven-plugin.jar -DpomFile=pom.xml

Using the WebLogic Maven Plug-In

8. Add the plugin configuration to your Maven Project pom.xml file as below:

<project>
  ...
 <build> 
  <plugins> 
   <plugin> 
      <groupId>com.oracle.weblogic</groupId> 
      <artifactId>weblogic-maven-plugin</artifactId> 
      <version>10.3.6.0</version> 
      <configuration> 
          <adminurl>t3://localhost:7001</adminurl>
          <user>weblogic</user> 
          <password>weblogic123</password> 
          <upload>true</upload> 
          <action>deploy</action> 
          <remote>false</remote> 
          <verbose>true</verbose> 
          <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> 
         <name>${project.build.finalName}</name> 
      </configuration> 
    </plugin> 
    ... 
   </plugins> 
 </build> 
</project>

9. Deploy on WebLogic
Now, you can use a shortened command-line goal invocation, such as:

mvn weblogic:deploy

Resources