Maven 2.x Source Plugin

Usage dependency-plugin with source-plugin causes BUILD ERROR

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Maven version: 2.0.8, Java version: 1.5.0_12, OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
  • Number of attachments :
    3

Description

I use dependecy-plugin to copy some jars into the project. I attach it to initialize phase. If i do so, the source-plugin gets silly.

[INFO] [jar:jar]
[INFO] Building jar: c:\share\sample-project\ISSUE\target\ISSUE-0.0.1-SNAPSHOT.jar
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'dependency:copy'

[0] Inside the definition for plugin 'maven-dependency-plugin' specify the following:

<configuration>
...
<artifactItems>VALUE</artifactItems>
</configuration>.

I get silly too. =(

Issue Links

Activity

Hide
Valeriy Gavrilovets added a comment -

The project to reproduce that issue.

Show
Valeriy Gavrilovets added a comment - The project to reproduce that issue.
Hide
Valeriy Gavrilovets added a comment -

Build Output.

Show
Valeriy Gavrilovets added a comment - Build Output.
Hide
Robert Golkosky added a comment -

I ran into this same problem when working with the cobertura plugin as well and I believe I've traced the problem back to the DefaultLifecycleExecutor and the DefaultPluginManager. The error appears to be triggered when executing a mojo which forks the project lifecycle (which is true for both the maven-source-plugin and the cobertura-maven-plugin) and another build plugin has been configured to not be inherited (as is the case with the dependency:copy mojo in the attached sample project). The role of the "inherited" attribute in triggering the error can be seen by commenting out the declaration in the sample pom, which will enable the build to pass.

What I think is happening is that when MojoExecutions are created by the DefaultLifecycleExecutor, the execution configuration is not populated. In addition, when the MavenProject is cloned to be the "executionProject" for the forked lifecycle, only those plugins which have inherited == true are copied over to the clone by ModelUtils.mergePluginLists(). Thus by the time that the DefaultPluginManager is confirming that the mojo is properly configured, you have an execution object which was constructed from the original project without any configuration elements and it is being evaluated in the scope of a cloned project which doesn't include the plugin definition.

Show
Robert Golkosky added a comment - I ran into this same problem when working with the cobertura plugin as well and I believe I've traced the problem back to the DefaultLifecycleExecutor and the DefaultPluginManager. The error appears to be triggered when executing a mojo which forks the project lifecycle (which is true for both the maven-source-plugin and the cobertura-maven-plugin) and another build plugin has been configured to not be inherited (as is the case with the dependency:copy mojo in the attached sample project). The role of the "inherited" attribute in triggering the error can be seen by commenting out the declaration in the sample pom, which will enable the build to pass. What I think is happening is that when MojoExecutions are created by the DefaultLifecycleExecutor, the execution configuration is not populated. In addition, when the MavenProject is cloned to be the "executionProject" for the forked lifecycle, only those plugins which have inherited == true are copied over to the clone by ModelUtils.mergePluginLists(). Thus by the time that the DefaultPluginManager is confirming that the mojo is properly configured, you have an execution object which was constructed from the original project without any configuration elements and it is being evaluated in the scope of a cloned project which doesn't include the plugin definition.
Hide
Robert Golkosky added a comment -

Attaching maven -X output which contains the stacktrace.

Show
Robert Golkosky added a comment - Attaching maven -X output which contains the stacktrace.
Hide
Robert Golkosky added a comment -

Linking to MNG-3700 which describes the core problem which causes this error.

Show
Robert Golkosky added a comment - Linking to MNG-3700 which describes the core problem which causes this error.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated: