You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Chris Lance (JIRA)" <ji...@codehaus.org> on 2007/08/02 18:28:13 UTC

[jira] Created: (MWAR-111) Transitive dependencies of optional dependencies are included in WEB-INF/lib

Transitive dependencies of optional dependencies are included in WEB-INF/lib
----------------------------------------------------------------------------

                 Key: MWAR-111
                 URL: http://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: 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 contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MWAR-111) Transitive dependencies of optional dependencies are included in WEB-INF/lib

Posted by "Antoni Reus (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MWAR-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=150959#action_150959 ] 

Antoni Reus commented on MWAR-111:
----------------------------------

Same problem here. As a workaround, you can put de de transitive dependencies in the exclusions list

> Transitive dependencies of optional dependencies are included in WEB-INF/lib
> ----------------------------------------------------------------------------
>
>                 Key: MWAR-111
>                 URL: http://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 contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MWAR-111) Transitive dependencies of optional dependencies are included in WEB-INF/lib

Posted by "Rich Taylor (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MWAR-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=171740#action_171740 ] 

Rich Taylor commented on MWAR-111:
----------------------------------

This is a serious issue for us as well.  Each time we add a new dependency to our EAR, it is automatically put into our WAR module's WEB-INF/lib, leading to duplicate jars and classloading issues.  It's very error prone to maintain a list of exclusions in the WAR's pom.   

> Transitive dependencies of optional dependencies are included in WEB-INF/lib
> ----------------------------------------------------------------------------
>
>                 Key: MWAR-111
>                 URL: http://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 contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MWAR-111) Transitive dependencies of optional dependencies are included in WEB-INF/lib

Posted by "Chris Lance (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MWAR-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Lance updated MWAR-111:
-----------------------------

    Attachment: AbstractWarMojo.java

This is a quick patch I put together against the trunk for this issue. Forgive my ignorance if there was an easier way to code it :-)

> Transitive dependencies of optional dependencies are included in WEB-INF/lib
> ----------------------------------------------------------------------------
>
>                 Key: MWAR-111
>                 URL: http://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, 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 contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MWAR-111) Transitive dependencies of optional dependencies are included in WEB-INF/lib

Posted by "Keith Naas (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MWAR-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Keith Naas updated MWAR-111:
----------------------------

    Attachment: MWAR-111.patch

Here is a patch that does a full search of the project dependencies instead of just one level deep.  

This is incredibly important for our company as we deploy ears, exclusively and if it scans through the entire dependency list to see if its optional, we can simply have one project control all of our common optional dependencies.

> Transitive dependencies of optional dependencies are included in WEB-INF/lib
> ----------------------------------------------------------------------------
>
>                 Key: MWAR-111
>                 URL: http://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 contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira