You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Adrian (JIRA)" <ji...@codehaus.org> on 2013/03/26 16:04:53 UTC
[jira] (MWAR-111) Transitive dependencies of optional dependencies
are included in WEB-INF/lib
[ https://jira.codehaus.org/browse/MWAR-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=322676#comment-322676 ]
Adrian commented on MWAR-111:
-----------------------------
Same thing here, this correction would be usefull even in 2013 :
* Eclipse m2e-wtp doesn't handle packagingExcludes with regex (as adviced by maven skinny wars instructions http://maven.apache.org/plugins/maven-war-plugin/examples/including-excluding-files-from-war.html).
* for pure Java EE 6 applicatins :
Java EE 6 doesn't say anything on CDI classloading rules for EAR.
For some appServers - i.e. JBoss 7.1, we need to package any archive containing CDI beans in EAR, never in war file otherwise we'll get AmiguousException when using n wars.
So we'll need to :
** package CDI bean archives in EAR.
** JSF related archives in WARs (otherwise faces-config.xml are not loaded).
So we're stuck with using scope provided in war pom.xml for now if we want to use Eclipse and JBoss 7.1 with a Java EE 6 EAR.
> Transitive dependencies of optional dependencies are included in WEB-INF/lib
> ----------------------------------------------------------------------------
>
> Key: MWAR-111
> URL: https://jira.codehaus.org/browse/MWAR-111
> Project: Maven 2.x WAR Plugin
> Issue Type: Bug
> Affects Versions: 2.0.2
> Environment: Maven 2.0.7, JDK 1.6.0_01-b06, JavaEE 5
> Reporter: Chris Lance
> Attachments: AbstractWarMojo.java, MWAR-111.patch, TestProject.zip
>
>
> I have an EAR project (TestEAR) which contains two modules:
> 1. A JAR module (TestJAR) which has one dependency: commons-lang 2.3
> 2. A WAR module (TestWAR) which uses [these instructions|http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html] to declare a dependency on TestJAR so that TestJAR is included in TestWAR's manifest classpath, but not copied into WEB-INF/lib (i.e. declares the dependency optional).
> This works fine for TestJAR itself, but its transitive dependency (commons-lang 2.3) is still copied into WEB-INF/lib. I don't believe this is the correct behavior since all dependencies of a JAR packaged in the EAR must also be packaged in the EAR. So, all a WAR should have to do is put the transitive dependencies in its manifest classpath to inherit them. Basically: in a WAR, transitive dependencies of "optional" dependencies should inherit the "optional" flag.
> I have included a simple test project as an example. Unzip, cd TestProject, and mvn install. Look in TestEAR's target dir and you will see that commons-lang is included in the EAR. Then look in TestWAR's target dir and you will see that commons-lang is also included in both the manifest classpath and the WEB-INF/lib dir.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira