You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Martin Höller <ma...@xss.co.at> on 2008/07/01 14:58:41 UTC

Re: Tip about Skinny Wars

Hi Arnaud!

I think I found one BIG problem with your workaround: it only works if you 
already have (the latest version of) your WAR's pom.xml file in the 
repository, otherwise maven 2.0.9 reports a missing dependency.

So this approach is not useable with the maven-release-plugin :-(

I made up a simple test project consisting of a parent and three modules: 
myJar, myWar, and myEar. myEar depends on myWar and myWar depends on myJar. 
With your approach and an empty repository the build fails due to a missing 
myWar:pom dependency.

As I think this list doesn't allow attachments I've made the sample 
available at http://www.xss.co.at/~martin/tmp/m2-skinny-war-demo.tar.bz2

A 'mvn package' fails, while a 'mvn install' succeeds.

Any comments?

- martin

On Tuesday 03 June 2008 Arnaud HERITIER wrote:
> Hi all,
>
>   I would like to share with you a workaround I found for the problem of
> transitive dependencies in skinny wars.
>   In the documentation it is said that :
>  "Now the painful part.  Your EAR's <<<pom.xml>>> needs to list every
> dependency that the WAR has.
>  This is because Maven assumes fat WARs and does not include transitive
> dependencies
>  of WARs within the EAR."
>
>   A workaround of this is to define for each war 2 dependencies. One for
> the war itself and another for the war's pom to retrieve transitive
> dependencies.
>   With that you'll have something like that in your ear dependencies :
>
>     <dependencies>
>         <dependency>
>             <groupId>com.acme</groupId>
>             <artifactId>war1</artifactId>
>             <version>1.0.0</version>
>             <type>war</type>
>         </dependency>
>         <dependency>
>             <groupId>com.acme</groupId>
>             <artifactId>war1</artifactId>
>             <version>1.0.0</version>
>             <type>pom</type>
>         </dependency>
>     </dependencies>
>
> I'm using maven 2.0.9.
>
> I'll do more tests tomorrow and I'll update the doc :
> http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.htm
>l
>
> Cheers
>
> arnaud



Re: Tip about Skinny Wars

Posted by Martin Höller <ma...@xss.co.at>.
On Tuesday 01 July 2008 Michael McCallum wrote:
> > On Tue, Jul 1, 2008 at 2:58 PM, Martin Höller <ma...@xss.co.at> wrote:
> > > I think I found one BIG problem with your workaround: it only works
> > > if you already have (the latest version of) your WAR's pom.xml file
> > > in the repository, otherwise maven 2.0.9 reports a missing
> > > dependency.
> > >
> > > So this approach is not useable with the maven-release-plugin :-(
>
> Rubbish i use this all the time with 2.0.9 without any problems. Have
> been since 2.0.5 and for at least for the last 6 months.

Did you try the sample project I posted? What are your results?

> It might be because I use ranges for deps though, and I don't use
> modules.

So you don't have a multimodule project? Well, that's what I was talking 
about! In a single-module project your declared dependencies have to be in 
a (local  or remote) repository anyway.

- martin

Re: Tip about Skinny Wars

Posted by Michael McCallum <gh...@apache.org>.
> On Tue, Jul 1, 2008 at 2:58 PM, Martin Höller <ma...@xss.co.at> wrote:
> > I think I found one BIG problem with your workaround: it only works if
> > you already have (the latest version of) your WAR's pom.xml file in the
> > repository, otherwise maven 2.0.9 reports a missing dependency.
> >
> > So this approach is not useable with the maven-release-plugin :-(
> >
Rubbish i use this all the time with 2.0.9 without any problems. Have been 
since 2.0.5 and for at least for the last 6 months.

It might be because I use ranges for deps though, and I don't use modules.

-- 
Michael McCallum
Enterprise Engineer
mailto:gholam@apache.org

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


Re: Tip about Skinny Wars

Posted by Arnaud HERITIER <ah...@gmail.com>.
My workaround is more a hack that something else.
It's not really logical to have in a project to dependencies to a pom and a
war of a same artifact.
This is certainly a bug in the core of maven which doesn't support it :-(
I'm trying to see how I can change the ear plugin to fix this issue.

Arnaud

On Tue, Jul 1, 2008 at 2:58 PM, Martin Höller <ma...@xss.co.at> wrote:

> Hi Arnaud!
>
> I think I found one BIG problem with your workaround: it only works if you
> already have (the latest version of) your WAR's pom.xml file in the
> repository, otherwise maven 2.0.9 reports a missing dependency.
>
> So this approach is not useable with the maven-release-plugin :-(
>
> I made up a simple test project consisting of a parent and three modules:
> myJar, myWar, and myEar. myEar depends on myWar and myWar depends on myJar.
> With your approach and an empty repository the build fails due to a missing
> myWar:pom dependency.
>
> As I think this list doesn't allow attachments I've made the sample
> available at http://www.xss.co.at/~martin/tmp/m2-skinny-war-demo.tar.bz2<http://www.xss.co.at/%7Emartin/tmp/m2-skinny-war-demo.tar.bz2>
>
> A 'mvn package' fails, while a 'mvn install' succeeds.
>
> Any comments?
>
> - martin
>
> On Tuesday 03 June 2008 Arnaud HERITIER wrote:
> > Hi all,
> >
> >   I would like to share with you a workaround I found for the problem of
> > transitive dependencies in skinny wars.
> >   In the documentation it is said that :
> >  "Now the painful part.  Your EAR's <<<pom.xml>>> needs to list every
> > dependency that the WAR has.
> >  This is because Maven assumes fat WARs and does not include transitive
> > dependencies
> >  of WARs within the EAR."
> >
> >   A workaround of this is to define for each war 2 dependencies. One for
> > the war itself and another for the war's pom to retrieve transitive
> > dependencies.
> >   With that you'll have something like that in your ear dependencies :
> >
> >     <dependencies>
> >         <dependency>
> >             <groupId>com.acme</groupId>
> >             <artifactId>war1</artifactId>
> >             <version>1.0.0</version>
> >             <type>war</type>
> >         </dependency>
> >         <dependency>
> >             <groupId>com.acme</groupId>
> >             <artifactId>war1</artifactId>
> >             <version>1.0.0</version>
> >             <type>pom</type>
> >         </dependency>
> >     </dependencies>
> >
> > I'm using maven 2.0.9.
> >
> > I'll do more tests tomorrow and I'll update the doc :
> >
> http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.htm
> >l
> >
> > Cheers
> >
> > arnaud
>
>
>