Covering J2EE Security and WebLogic Topics

Maven and the Tyranny of a WebLogic Installation

Can you stand another post on Maven and WebLogic? I can’t but I thought I’d document this anyway… 😉

I decided to revisit the problem outlined in Maven and WebLogicMBeanMaker in WebLogic 9/10 wherein you need to have an installation of WebLogic on the machine where you build your security provider. To refresh your memory if you read that post, the problem is that weblogic.jar uses relative paths to find other jars and thus defeats Maven’s dependency mechanism.

I came up with a solution that precludes having to have WebLogic installed but it still doesn’t use artifacts in the repository. Rather, it’s a hack but at least it’s a portable hack.

The solution is to have a directory that contains the required WebLogic jars in the required hierarchy. Here’s the directory structure and subset of files you need from the WLS 9.x installation:

./common/lib/apache_xbean.jar
./server/lib/ant/ant.jar
./server/lib/cssapi.jar
./server/lib/cssimpl.jar
./server/lib/mbeantypes
./server/lib/mbeantypes/wlManagementImplSource.jar
./server/lib/mbeantypes/wlManagementMBean.jar
./server/lib/mbeantypes/wlSecurityProviders.jar
./server/lib/mbeantypes/xacmlSecurityProviders.jar
./server/lib/schema/weblogic-domain-binding.jar
./server/lib/weblogic.jar
./server/lib/xbean.jar

I made a directory to contain the directories and files above and then used that high level directory in the pom like this:

<dependency>
  <groupId>weblogic</groupId>
  <artifactId>weblogic<artifactId>
  <version>9.2.0</version>
  <scope>system</scope>
  <systemPath>C:/WLS920/server/lib/weblogic.jar</systemPath></dependency>

<dependency>
  <groupId>weblogic</groupId>
  <artifactId>wlManagementMBean</artifactId>
  <version>9.2.0<version>
  <scope>system</scope>
<systemPath>C:/WLS920/server/lib/mbeantypes/wlManagementMBean.jar</systemPath>
</dependency>

<dependency>
  <groupId>weblogic</groupId>
  <artifactId>xmlbeans</artifactId>
  <version>1.0</version>
  <scope>system</scope>
  <systemPath>C:/WLS920/server/lib/xbean.jar</systemPath>
</dependency>

As long as your WebLogicMBeanMaker tasks use “maven.compile.classpath” in the classpath then it should work like a champ.

Being freed from the tyranny of a WebLogic installation is a relief and lends itself to painless builds on a continuous integration server, for example.

Obviously, this solution is for WLS 9 (is anyone still using that?) but providers built this way also work in WLS 10.