I have a similar configuration in my project. It is an EAR project with lots of WARs on their own. The goal was to provide a way to be able to debug/develop the WARs standalone e.g. via mvn tomcat7:run. In this situation you need all your dependencies (even platform JARs like openwebbeans, myfaces and openjpa) in your WEB-INF/lib folder. But those libs should not get packaged when building the final EAR.
I ended up with an own 'ear' profile with has war-excludes set: <profiles> <profile> <id>ear</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <packagingExcludes> ${war.excludes} </packagingExcludes> the war.excludes properties is maintained in a central location. Please note that the war.excludes contains a list of file names and not packages. E.g. WEB-INF/lib/openwebbeans-*,WEB-INF/lib/myfaces-api-*, ... LieGrue, strub >________________________________ > From: Vincent Latombe <vincent.lato...@gmail.com> >To: Maven Users List <users@maven.apache.org> >Sent: Friday, September 28, 2012 6:27 PM >Subject: Re: How to exclude transitive dependencies from war? > >Hello, > >I believe there is now a skinny war option in the ear plugin that could >help you to handle this case. I never used it so I cannot really tell you >more about it. > >Another option would be to have 2 profiles to build your war. One with all >dependencies provided by the ear marked as provided, and another one with >the same dependencies with compile/runtime scope. > >Again another option would be to exclude dependencies at package time (in >the war plugin configuration) > >Hope this helps, > >Vincent >Le 17 sept. 2012 21:10, "David Hoffer" <dhoff...@gmail.com> a écrit : > >> I need to package a war so that it can be optionally included in a ear >> deployment, put I can't just mark the ear level dependencies as >> provided because I do need the full war doing development work and >> running GWT hosted mode. >> >> I've followed this link >> >> http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html >> regarding how to set the dependency as optional, which seems like it >> might be the right solution, as I want the full war in the current >> project but when used as an ear dependency I want it to exclude a >> dependency (and all its transitive dependencies). >> >> However its not working that way...if I set the artifact via: >> >> <dependency> >> <groupId>com.foo</groupId> >> <artifactId>bar</artifactId> >> <scope>compile</scope> >> <optional>true</optional> >> </dependency> >> >> It removes just the artifact bar from the war but leaves in the war >> all it's transitive dependencies, which is not expected. How can I >> also exclude it's transitive dependencies? This point is key as the >> logic provided by the ear is significant and probably has 100 or more >> jars...no way to know what they all are and that can change too. >> >> -Dave >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org