You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Keith Naas (JIRA)" <ji...@codehaus.org> on 2007/11/29 21:32:57 UTC

[jira] Created: (MECLIPSE-360) Optional web app dependencies are not treated the same way as maven-ear-plugin

Optional web app dependencies are not treated the same way as maven-ear-plugin
------------------------------------------------------------------------------

                 Key: MECLIPSE-360
                 URL: http://jira.codehaus.org/browse/MECLIPSE-360
             Project: Maven 2.x Eclipse Plugin
          Issue Type: Bug
          Components: WTP support
    Affects Versions: 2.5
         Environment: eclipse 3.3.0, wtp 2.0.1, jboss 4.2.2
            Reporter: Keith Naas


Based on the information in http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html, we have dependencies declared in our EARs so that all dependencies reside in the ear instead of being isolated (and duplicated) in each of the contained war's "WEB-INF\lib".  This is done by declaring the war dependencies as optional.  Proper manifest entries are added to the war, and the resulting ear contains all of the necessary jars.   

When running "mvn install" for such an ear project, the resulting ear is created correctly.  

When running "mvn eclipse:eclipse" for such an ear project, and then using WTP to deploy the artificact to a server (e.g. tomcat or jboss), the generated ear contains a war where all of those war optional dependencies are packaged in the war.  This results in ClassLoader mayhem.  It appears that this is happening because AbstractWtpResourceWriter adds the optional war dependencies with a specific deployPath of "WEB-INF\lib".   To fix this, we would need to either add the "optional" flag to the IDEDependency and then use it withing AbstractWtpResourceWriter.writeWarOrEarResources to only use assign a "WEB-INF\lib" deployDir if the IDEDepedency is not optional.

I can make those changes and create a patch file so that the maven-eclipse-plugin is made consistent with the maven-ear-plugin.

-- 
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: (MECLIPSE-360) Optional web app dependencies are not treated the same way as maven-ear-plugin

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

Keith Naas commented on MECLIPSE-360:
-------------------------------------

Its actually the maven-war-plugin, not the maven-ear-plugin that does this work.  Specifically, ArtifactsPackageTask.performPackaging which only packages a dependency if it is not optional and it is a runtime dependency.    

I am going to code the patch so it does the same checks when determining whether or not to do the "WEB-INF\lib" deploy folder.

> Optional web app dependencies are not treated the same way as maven-ear-plugin
> ------------------------------------------------------------------------------
>
>                 Key: MECLIPSE-360
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-360
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: Bug
>          Components: WTP support
>    Affects Versions: 2.5
>         Environment: eclipse 3.3.0, wtp 2.0.1, jboss 4.2.2
>            Reporter: Keith Naas
>
> Based on the information in http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html, we have dependencies declared in our EARs so that all dependencies reside in the ear instead of being isolated (and duplicated) in each of the contained war's "WEB-INF\lib".  This is done by declaring the war dependencies as optional.  Proper manifest entries are added to the war, and the resulting ear contains all of the necessary jars.   
> When running "mvn install" for such an ear project, the resulting ear is created correctly.  
> When running "mvn eclipse:eclipse" for such an ear project, and then using WTP to deploy the artificact to a server (e.g. tomcat or jboss), the generated ear contains a war where all of those war optional dependencies are packaged in the war.  This results in ClassLoader mayhem.  It appears that this is happening because AbstractWtpResourceWriter adds the optional war dependencies with a specific deployPath of "WEB-INF\lib".   To fix this, we would need to either add the "optional" flag to the IDEDependency and then use it withing AbstractWtpResourceWriter.writeWarOrEarResources to only use assign a "WEB-INF\lib" deployDir if the IDEDepedency is not optional.
> I can make those changes and create a patch file so that the maven-eclipse-plugin is made consistent with the maven-ear-plugin.

-- 
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: (MECLIPSE-360) Optional web app dependencies are not treated the same way as maven-ear-plugin

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

Keith Naas updated MECLIPSE-360:
--------------------------------

    Attachment: MECLIPSE-360.patch

Path that fixes two issues with optional dependencies:

1. Optional WAR dependencies for WTP 1.5+ are not added as direct classpath dependencies.  Instead the WTP "org.eclipse.jst.j2ee.internal.module.container" classpath container is added automatically.  Since they are no longer direct dependencies, sources and javadocs are not defined in the .classpath file.  Instead they will need to be added to a the workspaces ".metadata/.plugins/org.eclipse.jst.j2eeclasspath.decorations.xml".  For example, 
 <classpath>
  <container id="org.eclipse.jst.j2ee.internal.module.container">
   <entry id="<absolutePathToM2_REPO>/commons-lang/commons-lang/2.3/commons-lang-2.3.jar">
    <source-attachment-path><absolutePathToM2_REPO>/commons-lang/commons-lang/2.3/commons-lang-2.3-sources.jar</source-attachment-path>
    <attribute name="javadoc_location">jar:file:/<absolutePathToM2_REPO>/commons-lang/commons-lang/2.3/commons-lang-2.3-javadocs.jar!/</attribute>
   </entry>
  </container>
 </classpath>

2.  Optional WAR dependencies are not deployed to WEB-INF\lib.  This makes the packaging done by WTP consistent with the maven-war-plugin.

(Please note that this also includes a patch for MECLIPSE-284 since that was in my source tree as well).

> Optional web app dependencies are not treated the same way as maven-ear-plugin
> ------------------------------------------------------------------------------
>
>                 Key: MECLIPSE-360
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-360
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: Bug
>          Components: WTP support
>    Affects Versions: 2.5
>         Environment: eclipse 3.3.0, wtp 2.0.1, jboss 4.2.2
>            Reporter: Keith Naas
>         Attachments: MECLIPSE-360.patch
>
>
> Based on the information in http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html, we have dependencies declared in our EARs so that all dependencies reside in the ear instead of being isolated (and duplicated) in each of the contained war's "WEB-INF\lib".  This is done by declaring the war dependencies as optional.  Proper manifest entries are added to the war, and the resulting ear contains all of the necessary jars.   
> When running "mvn install" for such an ear project, the resulting ear is created correctly.  
> When running "mvn eclipse:eclipse" for such an ear project, and then using WTP to deploy the artificact to a server (e.g. tomcat or jboss), the generated ear contains a war where all of those war optional dependencies are packaged in the war.  This results in ClassLoader mayhem.  It appears that this is happening because AbstractWtpResourceWriter adds the optional war dependencies with a specific deployPath of "WEB-INF\lib".   To fix this, we would need to either add the "optional" flag to the IDEDependency and then use it withing AbstractWtpResourceWriter.writeWarOrEarResources to only use assign a "WEB-INF\lib" deployDir if the IDEDepedency is not optional.
> I can make those changes and create a patch file so that the maven-eclipse-plugin is made consistent with the maven-ear-plugin.

-- 
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: (MECLIPSE-360) Optional web app dependencies are not treated the same way as maven-ear-plugin

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

Keith Naas commented on MECLIPSE-360:
-------------------------------------

And I forgot a third fix that was part of this.

3.  Exclusions that we had defined in DependencyManagement were not being applied to the generated eclipse files.  I have changed the dependency exclusion code to take DependencyManagement exclusions into account.  



> Optional web app dependencies are not treated the same way as maven-ear-plugin
> ------------------------------------------------------------------------------
>
>                 Key: MECLIPSE-360
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-360
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: Bug
>          Components: WTP support
>    Affects Versions: 2.5
>         Environment: eclipse 3.3.0, wtp 2.0.1, jboss 4.2.2
>            Reporter: Keith Naas
>         Attachments: MECLIPSE-360.patch
>
>
> Based on the information in http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html, we have dependencies declared in our EARs so that all dependencies reside in the ear instead of being isolated (and duplicated) in each of the contained war's "WEB-INF\lib".  This is done by declaring the war dependencies as optional.  Proper manifest entries are added to the war, and the resulting ear contains all of the necessary jars.   
> When running "mvn install" for such an ear project, the resulting ear is created correctly.  
> When running "mvn eclipse:eclipse" for such an ear project, and then using WTP to deploy the artificact to a server (e.g. tomcat or jboss), the generated ear contains a war where all of those war optional dependencies are packaged in the war.  This results in ClassLoader mayhem.  It appears that this is happening because AbstractWtpResourceWriter adds the optional war dependencies with a specific deployPath of "WEB-INF\lib".   To fix this, we would need to either add the "optional" flag to the IDEDependency and then use it withing AbstractWtpResourceWriter.writeWarOrEarResources to only use assign a "WEB-INF\lib" deployDir if the IDEDepedency is not optional.
> I can make those changes and create a patch file so that the maven-eclipse-plugin is made consistent with the maven-ear-plugin.

-- 
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: (MECLIPSE-360) Optional web app dependencies are not treated the same way as maven-ear-plugin

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

Antoni Reus commented on MECLIPSE-360:
--------------------------------------

Same problem here. Is there any workaround for this without manually editing generated file  org.eclipse.wst.common.component

> Optional web app dependencies are not treated the same way as maven-ear-plugin
> ------------------------------------------------------------------------------
>
>                 Key: MECLIPSE-360
>                 URL: http://jira.codehaus.org/browse/MECLIPSE-360
>             Project: Maven 2.x Eclipse Plugin
>          Issue Type: Bug
>          Components: WTP support
>    Affects Versions: 2.5
>         Environment: eclipse 3.3.0, wtp 2.0.1, jboss 4.2.2
>            Reporter: Keith Naas
>         Attachments: MECLIPSE-360.patch
>
>
> Based on the information in http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html, we have dependencies declared in our EARs so that all dependencies reside in the ear instead of being isolated (and duplicated) in each of the contained war's "WEB-INF\lib".  This is done by declaring the war dependencies as optional.  Proper manifest entries are added to the war, and the resulting ear contains all of the necessary jars.   
> When running "mvn install" for such an ear project, the resulting ear is created correctly.  
> When running "mvn eclipse:eclipse" for such an ear project, and then using WTP to deploy the artificact to a server (e.g. tomcat or jboss), the generated ear contains a war where all of those war optional dependencies are packaged in the war.  This results in ClassLoader mayhem.  It appears that this is happening because AbstractWtpResourceWriter adds the optional war dependencies with a specific deployPath of "WEB-INF\lib".   To fix this, we would need to either add the "optional" flag to the IDEDependency and then use it withing AbstractWtpResourceWriter.writeWarOrEarResources to only use assign a "WEB-INF\lib" deployDir if the IDEDepedency is not optional.
> I can make those changes and create a patch file so that the maven-eclipse-plugin is made consistent with the maven-ear-plugin.

-- 
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