Thursday

Correct dependency configuration for maven-weblogic-plugin to deploy in Weblogic server 10.3.0.0

Mojo weblogic plugin version 2.9.0 is not stable for Weblogic server 10.3.0.0. Configuration which suggest on the mojo documentation is not working for current Weblogic server version and produce some hopeless error. Seems installed weblogic.jar and webservices.jar on local repository is not using properly on plug ins life cycle. However it's easy to fix the error through system scope dependency which i will demonstrate below:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.fors.test.gwt.core</groupId>
<artifactId>core-web</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>core-web</name>
<url>http://www.fors.ru</url>
<parent>
<groupId>ru.fors.test.gwt.core</groupId>
<artifactId>app</artifactId>
<version>1.0</version>
</parent>
<properties>
<weblogic.version>1.0</weblogic.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/gwt-servlet.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>system</scope>
<systemPath>${GWT_HOME}/gwt-user.jar</systemPath>
</dependency>    
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev-windows</artifactId>
<version>${gwtVersion}</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/gwt-dev-windows.jar</systemPath>
</dependency>  
</dependencies>
<build>
<finalName>core-web</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- maven googletoolkit plugin-->
<plugin>
<groupId>com.totsp.gwt</groupId>
<artifactId>maven-googlewebtoolkit2-plugin</artifactId>
<version>2.0-beta6</version>
<configuration>
<extraJvmArgs>-Xmx512m</extraJvmArgs>
<runTarget>HelloGWT.html</runTarget>
<compileTargets>
<param>ru.fors.test.gwt.core.HelloGWT</param>
</compileTargets>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
<executions>
<execution>
<goals>
<goal>mergewebxml</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webXml>target/web.xml</webXml>
</configuration>
</plugin>
<!-- maven weblogic plugin configuration -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>2.9.0</version>
<configuration>
<adminServerHostName>localhost</adminServerHostName>
<adminServerPort>7001</adminServerPort>
<adminServerProtocol>t3</adminServerProtocol>
<userId>weblogic</userId>
<password>weblogic</password>
<upload>false</upload>
<remote>false</remote>
<verbose>false</verbose>
<debug>false</debug>
<targetNames>AdminServer</targetNames>
<exploded>false</exploded>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>weblogic</artifactId>
<version>${weblogic.version}</version>
<scope>system</scope>
<systemPath>PATH_TO_LIBRARY/weblogic.jar</systemPath>
</dependency>
<dependency>
<groupId>weblogic</groupId>
<artifactId>webservices</artifactId>
<version>${weblogic.version}</version>
<scope>system</scope>
<systemPath>PATH_TO_LIBRARY/webservices.jar</systemPath>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.html</include>
<include>**/*.xml</include>
<include>**/*.css</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>
Post a Comment