
Auto deployment of Maven artifacts to Oracle Weblogic

I found this time a new way to deploy #Maven artefacts using the Oracle Weblogic Ant API!
If you remember my previous post, there is many ways to deploy your war/ear to Oracle Weblogic
- Using Oracle Weblogic development mode, a mode in which a simple copy of your files in a specific autodeploy directory trigger the update/install of these
- Using Maven Cargo, this work only if your Oracle Weblogic container is local (see here) on the same machine, where Apache #Maven is running
- Using a very old #Maven plugin (2008), local and remote container are supported, but our builds were sometimes hanging during pre integration phase for no apparent reasons.
And now using the official ANT API of Oracle, by far the MOST stable of all!
Use the following steps to create a wlfullclient.jar
file for a JDK 1.6 client application:
Change directories to the server/lib
directory.
cd WL_HOME/server/lib
Use the following command to create wlfullclient.jar
in the server/lib
directory:
java -jar wljarbuilder.jar
You can now deploy this huge jar file wlfullclient.jar
(59 MB) to your Artifactory/Nexus/Archiva repository
We need another jar file, this one can be found in bea/modules directory. Install also com.bea.core.descriptor.wl_1.1.0.0.jar into your local maven repository
<dependency> <groupid>weblogic</groupid> <artifactid>com.bea.core.descriptor.wl</artifactid> <version>1.1.0.0</version> </dependency>
We need another jar file, this one can also be found in bea/modules directory. Install also webservices.jar into your local maven repository
<dependency> <groupid>weblogic</groupid> <artifactid>com.bea.core.descriptor.wl</artifactid> <version>1.1.0.0</version> </dependency>
Now put these line in your pom.xml and run a build in phase package
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-antrun-plugin</artifactid> <version>1.3</version> <configuration> <tasks> <taskdef name="wldeploy" classname="weblogic.ant.taskdefs.management.WLDeploy" classpathref="maven.plugin.classpath"> <wldeploy debug="true" name="web" password="weblogic" verbose="true" upload="true" source="target/artifact.war" user="weblogic" adminurl="t3://weblogichost:7001" targets="myManagedServerName"></wldeploy> </taskdef> </tasks> </configuration> <dependencies> <dependency> <groupid>com.sun</groupid> <artifactid>tools</artifactid> <version>${java.version}</version> <scope>system</scope> <systempath>${java.home}/../lib/tools.jar</systempath> </dependency> <dependency> <groupid>weblogic</groupid> <artifactid>webservices</artifactid> <version>10.3</version> </dependency> <dependency> <groupid>weblogic</groupid> <artifactid>wlfullclient</artifactid> <version>10.3</version> </dependency> <dependency> <groupid>weblogic</groupid> <artifactid>com.bea.core.descriptor.wl</artifactid> <version>1.1.0.0</version> </dependency> </dependencies> </plugin>
run with
mvn clean package antrun:run