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 Gamache (JIRA)" <ji...@codehaus.org> on 2011/12/01 19:07:39 UTC

[jira] Created: (MWAR-269) war fails to build while using m2e in workspace resolution mode

war fails to build while using m2e in workspace resolution mode
---------------------------------------------------------------

                 Key: MWAR-269
                 URL: https://jira.codehaus.org/browse/MWAR-269
             Project: Maven 2.x WAR Plugin
          Issue Type: Improvement
    Affects Versions: 2.1.1
            Reporter: Chris Gamache
         Attachments: maven-war-plugin.patch

This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....

When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.

See attached patch for your review...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Chris Gamache (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=300830#comment-300830 ] 

Chris Gamache commented on MWAR-269:
------------------------------------

I don't think so, but I am no Maven expert.

The problem I was observing was an interaction in the war plugin plus m2e. In workspace resolution mode, m2e is happy to provide a folder of classes instead of building a jar for a named artifact. This is fine when you stay within the bounds of Eclipse for your program execution. If you happen to want to build a war consisting of classes in the workspace using m2e you're out of luck.

Taking a page from the way the assembly plugin handles this situation, the patch I proposed would allow the war plugin to package the classes folder and add it to the war.
                
> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Thomas Broyer (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=300828#comment-300828 ] 

Thomas Broyer commented on MWAR-269:
------------------------------------

Isn't that a manifestation of MNG-5214?
                
> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Chris Gamache (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=285350#comment-285350 ] 

Chris Gamache commented on MWAR-269:
------------------------------------

Sure, here's a recipe...

Steps to reproduce:

1. Install Eclipse (tested on Helios and Indigo)
2. Install m2e from update site http://download.eclipse.org/technology/m2e/releases/
3. Create Maven project for the war deployment
4. Put the maven-war-plugin in the pom.xml file
5. Create another Maven project in the workspace with jar packaging (this will be your dependency-- Project B)
6. Make Project A depend on Project B by adding Project B's groupId, artifactId, and version in the dependencies section in pom.xml file for Project A
7. Right click Project A -> Run -> Maven Build...
8. Configure then Run panel as you see in the screenshot.
9. Run 

> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MWAR-269) war fails to build while using m2e in workspace resolution mode

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

Chris Gamache updated MWAR-269:
-------------------------------

    Attachment: screenshot-1.png

> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Thomas Broyer (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=300832#comment-300832 ] 

Thomas Broyer commented on MWAR-269:
------------------------------------

Ah, you're right. The issue seems to actually be that the war plugin doesn't support artifacts coming from the reactor, when they haven't been packaged, when using Maven 3.

To reproduce outside Eclipse: have a module B with packaging=war depends on a module A with packaging=jar; configure the war plugin to execute {{war:exploded}} in the {{prepare-package}} phase, then run {{mvn prepare-package}} at the reactor level. Building project B will fail when it'll try to copy project A, because it expects a packaged JAR, but the JAR wasn't created as the {{package}} phase wasn't executed, so Maven 3 gives the {{project.build.outputDirectory}} ({{target/classes}}) instead.

FYI, the Tomcat plugin has a special step using {{MavenProject#getCompileClasspathElements}} (the war plugin could use {{getRuntimeClasspathElements}}) and then only {{getDependencies}} (where the war plugin uses {{getArtifacts}}), skipping those that are part of {{getProjectReferences}}.
I'm afraid it would require an important refactoring of the war plugin though.
See https://github.com/apache/tomcat-maven-plugin/blob/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
                
> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Chris Gamache (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293136#comment-293136 ] 

Chris Gamache edited comment on MWAR-269 at 3/1/12 10:09 AM:
-------------------------------------------------------------

Have you given any more thought to implementing this?
                
      was (Author: iamchris):
    Have you given any more thought on implementing this?
                  
> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Chris Gamache (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293136#comment-293136 ] 

Chris Gamache commented on MWAR-269:
------------------------------------

Have you given any more thought on implementing this?
                
> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch, screenshot-1.png
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MWAR-269) war fails to build while using m2e in workspace resolution mode

Posted by "Stephane Nicoll (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MWAR-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=285164#comment-285164 ] 

Stephane Nicoll commented on MWAR-269:
--------------------------------------

It think the patch makes sense and is clean/short enough to be applied but before doing so I would like to reproduce your issue. Can you add a sample project or explain how I can reproduce the issue? Thanks.

> war fails to build while using m2e in workspace resolution mode
> ---------------------------------------------------------------
>
>                 Key: MWAR-269
>                 URL: https://jira.codehaus.org/browse/MWAR-269
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.1.1
>            Reporter: Chris Gamache
>         Attachments: maven-war-plugin.patch
>
>
> This is my first time for an issue/patch submission. Apologies if I'm doing it wrong....
> When building in Eclipse using m2e in workspace resolution mode, the maven-war-plugin is not prepared for a "dependency" which isn't an assembly but is instead a folder containing the compiled classes from within the local workspace. I propose that if the incoming dependency happens to be a directory that it get packaged up and copied to the destination instead of blowing up with an exception.
> See attached patch for your review...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira