You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Scott Chun <ch...@gmail.com> on 2012/04/01 17:30:51 UTC

Ear Plugin skinnyWars EJB problem

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

Re: Ear Plugin skinnyWars EJB problem

Posted by nskmda <ns...@binkmail.com>.
Not sure what you mean.
A brief sample config?



--
View this message in context: http://maven.40175.n5.nabble.com/Ear-Plugin-skinnyWars-EJB-problem-tp5611113p5723651.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ear Plugin skinnyWars EJB problem

Posted by Markku Saarela <ma...@iki.fi>.
In that case WAR Overlays[1] come into picture.

Markku

[1] http://maven.apache.org/plugins/maven-war-plugin/overlays.html

On 09/25/2012 05:57 PM, nskmda wrote:
> Well, okay, I read that instruction.
>
> But I may also need to have a WAR artifact including all dependent EJBs in
> case I want to deploy it as WAR only, no EAR.
>
> In this case I still need to preserve original WAR dependencies.
> And I need m-ear-p to strip them if they're a listed as EAR dependencies
> (when I configure m-ear-p to produce "skinnyWar" modules).
>
> This doesn't really work.
> Whatever <type>jar</type> dependencies I have in my EAR artifact get
> stripped from the WAR.
>
> But no <type>ejb</type> EAR dependencies get stripped from WAR.
> And I can't do a <type>jar</type> on them because I will loose the
> <ejbModule> capability (to generate proper application.xml).
>
> I guess, there was something in mind when making m-ear-p to skip those
> <type>ejb</type> dependencies when stripping down WAR artifact.
>
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Ear-Plugin-skinnyWars-EJB-problem-tp5611113p5723616.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ear Plugin skinnyWars EJB problem

Posted by nskmda <ns...@binkmail.com>.
Well, okay, I read that instruction.

But I may also need to have a WAR artifact including all dependent EJBs in
case I want to deploy it as WAR only, no EAR.

In this case I still need to preserve original WAR dependencies.
And I need m-ear-p to strip them if they're a listed as EAR dependencies
(when I configure m-ear-p to produce "skinnyWar" modules).

This doesn't really work.
Whatever <type>jar</type> dependencies I have in my EAR artifact get
stripped from the WAR.

But no <type>ejb</type> EAR dependencies get stripped from WAR.
And I can't do a <type>jar</type> on them because I will loose the
<ejbModule> capability (to generate proper application.xml).

I guess, there was something in mind when making m-ear-p to skip those
<type>ejb</type> dependencies when stripping down WAR artifact.



--
View this message in context: http://maven.40175.n5.nabble.com/Ear-Plugin-skinnyWars-EJB-problem-tp5611113p5723616.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ear Plugin skinnyWars EJB problem

Posted by Wayne Fay <wa...@gmail.com>.
> 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.

You failed to read and properly implement the directions on the
"Creating Skinny WARs" page. Go back and look for the word "excludes":
http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html

You may also find it helpful to run a "mvn clean" at least once to
clean things up after fixing your configuration error.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ear Plugin skinnyWars EJB problem

Posted by sarmahdi <sa...@hotmail.com>.
I tried this approach,

/<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> //this
excludes all jars from being added to the WAR.
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<classpathPrefix>lib/</classpathPrefix>
						</manifest>
					</archive>
					<failOnMissingWebXml>false</failOnMissingWebXml>
					
				</configuration>
			</plugin>/

--
View this message in context: http://maven.40175.n5.nabble.com/Ear-Plugin-skinnyWars-EJB-problem-tp5611113p5611958.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org