I am trying to create a multi-module "skinny war" exploded EAR by using the
"skinnyWars" option of the maven-ear-plugin. The problem I am having is
that the EJB module dependencies of the WAR modules (there are 5) are being
left in the WEB-INF/lib directory of the WAR modules as well as unpacked in
the root of the EAR. This results in a deployment error.

The EAR module POM is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd";>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany</groupId>
<artifactId> mycompany-app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.mycompany </groupId>
<artifactId>mycompany-app-ear</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>ear</packaging>
<name>mycompany App EAR Module</name>

<dependencies>
<!--
DRY skinny WAR Dependencies.
Declare war module as type pom so that their dependencies will be included.
-->
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-web</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-facade</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-business</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-dao</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-services</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!--
DRY skinny WAR Dependencies.
Include the actual war modules as dependencies.
-->
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-facade</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-business</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-dao</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-shared</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>${maven-ear-plugin.version}</version>
<configuration>
<version>6</version>
<skinnyWars>true</skinnyWars>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
<generateApplicationXml>true</generateApplicationXml>
<unpackTypes>rar,war,ejb</unpackTypes>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

An example of my war module pom is. I have omitted 3rd party dependencies
for brevity:

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd";>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<groupId>com.mycompany</groupId>
<artifactId>mycompany-app-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>mycompany App Web Module</name>

<dependencies>
<!-- 3rd party dependencies omitted -->

<!-- Project dependencies -->
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-shared-common</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-shared-test</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<version>${project.version}</version>
<artifactId>mycompany-shared-dom-dto</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-shared-dom-entity</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-shared-utilities</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-shared-services</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<webResource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<includes>
<include>web.xml</include>
</includes>
<targetPath>WEB-INF</targetPath>
<filtering>true</filtering>
<webResource>
<directory>${basedir}/src/main/webapp/shared/shared</directory>
<includes>
 <include>commonLayout.xhtml</include>
</includes>
<targetPath>shared/shared</targetPath>
<filtering>true</filtering>
</webResource>
</webResources>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>

</project>

When building the skinnyWars EAR, the JAR modules are being packaged in the
LIB/ directory as expected. The EJB
module, mycompany-shared-services.jar, is unpacked at the root of the EAR
module AND also packaged in the mycompany-app-web.war/WEB-INF/lib
directory. Consequently, I cannot deploy the EAR.

I have also confirmed that this same situation happens when I remove the
"unpackTypes" option and build a compressed EAR.

I am using Maven 3.0.4 on Mac OSX 10.7.3.

maven-ear-plugin ver. 2.7
maven-war-plugin ver. 2.1.1
maven-ejb-plugin ver. 2.3

Any help would be greatly appreciated.

Regards,
SChun

Reply via email to