Maven 2 & 3

Reactor does not allow multiple plugin versions across projects

Details

  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

I have a multiproject build which has the following dependency tree:

top

  • storage
  • xdoclet plugin
  • antrun plugin 1.0-alpha-1
  • core
  • antrun plugin 1.0-alpha-2

When I run the build for storage and core by themselves, everything is groovy.
When I run the top-level build, the storage build and xdoclet plugin run just great but the core build fails with the following message:

[ERROR] Nonexistent component: org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-antrun-plugin:1.0-alpha-1:run

I am assuming there is some problem with multiple versions of the same plugin and the reactor but it certainly could be something I am missing in my pom. Here's how core is defining the plugin:

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
...

Issue Links

Activity

Hide
Jerome Lacoste added a comment -

Hitting the exact same issue right now. Investigating...

Show
Jerome Lacoste added a comment - Hitting the exact same issue right now. Investigating...
Hide
Jerome Lacoste added a comment -

My findings, so far . I have a multiproject with following modules

core
clients
webapp
full-webapp
standalone

executed in that order

It only fails when using the reactor when trying to build the webapp module.

It tries to find the war-plugin v 2.0-beta-2 while the 2.0-beta-3-SNAPSHOT was (I think) to be searched.

[DEBUG] org.apache.maven.plugins:maven-war-plugin:maven-plugin:2.0-beta-3-SNAPSHOT (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime)
[...]
[DEBUG] org.apache.maven:maven-artifact:jar:2.0 (selected for runtime)
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime)
[ERROR] Nonexistent component: org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-war-plugin:2.0-beta-2:war

At this point, in DefaultLifeCycleEditor:

private void executeGoal( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException, BuildFailureException
{
try
{
if ( getPhaseToLifecycleMap().containsKey( task ) )
{
Lifecycle lifecycle = getLifecycleForPhase( task );

// we have a lifecycle phase, so lets bind all the necessary goals
Map lifecycleMappings = constructLifecycleMappings( session, task, project, lifecycle );
executeGoalWithLifecycle( task, session, lifecycleMappings, project, lifecycle );

the lifecycle mappings are already wrong. They map to the beta-2 version. Now investigating the lifecyclemapping construction.

Handy breakpoints

Show
Jerome Lacoste added a comment - My findings, so far . I have a multiproject with following modules core clients webapp full-webapp standalone executed in that order It only fails when using the reactor when trying to build the webapp module. It tries to find the war-plugin v 2.0-beta-2 while the 2.0-beta-3-SNAPSHOT was (I think) to be searched. [DEBUG] org.apache.maven.plugins:maven-war-plugin:maven-plugin:2.0-beta-3-SNAPSHOT (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime) [...] [DEBUG] org.apache.maven:maven-artifact:jar:2.0 (selected for runtime) [DEBUG] org.codehaus.plexus:plexus-utils:jar:1.0.4 (selected for runtime) [ERROR] Nonexistent component: org.apache.maven.plugin.Mojoorg.apache.maven.plugins:maven-war-plugin:2.0-beta-2:war At this point, in DefaultLifeCycleEditor: private void executeGoal( String task, MavenSession session, MavenProject project ) throws LifecycleExecutionException, BuildFailureException { try { if ( getPhaseToLifecycleMap().containsKey( task ) ) { Lifecycle lifecycle = getLifecycleForPhase( task ); // we have a lifecycle phase, so lets bind all the necessary goals Map lifecycleMappings = constructLifecycleMappings( session, task, project, lifecycle ); executeGoalWithLifecycle( task, session, lifecycleMappings, project, lifecycle ); the lifecycle mappings are already wrong. They map to the beta-2 version. Now investigating the lifecyclemapping construction. Handy breakpoints
Hide
Jerome Lacoste added a comment -

I traced the issue to the pluginDescriptors not taking into account the plugin version in the getJey() method.
Thus.

public PluginDescriptor getPluginDescriptor( Plugin plugin )

{ // TODO: include version, but can't do this in the plugin manager as it is not resolved to the right version // at that point. Instead, move the duplication check to the artifact container, or store it locally based on // the unresolved version? return (PluginDescriptor) pluginDescriptors.get( plugin.getKey() ); }

The comment was added when implementing MNG-377.

I would need some hints to try to fix that as it is a little bit too close to the core for me

Forcing dependency doesn't seem to help.
Until this is implemented, maybe there's a way to achieve a work-around by purging the pluginDescriptors at some point?

Show
Jerome Lacoste added a comment - I traced the issue to the pluginDescriptors not taking into account the plugin version in the getJey() method. Thus. public PluginDescriptor getPluginDescriptor( Plugin plugin ) { // TODO: include version, but can't do this in the plugin manager as it is not resolved to the right version // at that point. Instead, move the duplication check to the artifact container, or store it locally based on // the unresolved version? return (PluginDescriptor) pluginDescriptors.get( plugin.getKey() ); } The comment was added when implementing MNG-377. I would need some hints to try to fix that as it is a little bit too close to the core for me Forcing dependency doesn't seem to help. Until this is implemented, maybe there's a way to achieve a work-around by purging the pluginDescriptors at some point?
Hide
John Casey added a comment -

Fix for MNG-3284 should apply here.

Show
John Casey added a comment - Fix for MNG-3284 should apply here.

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: