diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java index 176ba320a71a..8c809de82de3 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java @@ -41,9 +41,9 @@ public class DefaultMojoExecutionConfigurator @Override public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig ) { - String g = mojoExecution.getGroupId(); + String g = mojoExecution.getPlugin().getGroupId(); - String a = mojoExecution.getArtifactId(); + String a = mojoExecution.getPlugin().getArtifactId(); Plugin plugin = findPlugin( g, a, project.getBuildPlugins() ); diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java index 133bcb3a2137..cdb00fc02adf 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/BuildPluginManagerStub.java @@ -42,7 +42,7 @@ public PluginDescriptor loadPlugin( Plugin plugin, List reposi public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List repositories, RepositorySystemSession session ) { - return MojoExecutorStub.createMojoDescriptor( plugin.getKey() ); + return MojoExecutorStub.createMojoDescriptor( plugin ); } public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor ) diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java index 8a6580b699af..763893e6ce9a 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/MojoExecutorStub.java @@ -21,6 +21,7 @@ import org.apache.maven.lifecycle.internal.MojoExecutor; import org.apache.maven.lifecycle.internal.PhaseRecorder; import org.apache.maven.lifecycle.internal.ProjectIndex; +import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptor; @@ -54,12 +55,14 @@ public void execute( MavenSession session, List mojoExecutions, P } - public static MojoDescriptor createMojoDescriptor( String mojoDescription ) + public static MojoDescriptor createMojoDescriptor( Plugin plugin ) { final PluginDescriptor descriptor = new PluginDescriptor(); - descriptor.setArtifactId( mojoDescription ); + descriptor.setGroupId( plugin.getGroupId() ); + descriptor.setArtifactId( plugin.getArtifactId() ); + descriptor.setPlugin( plugin ); + descriptor.setVersion( plugin.getVersion() ); final MojoDescriptor mojoDescriptor = new MojoDescriptor(); - mojoDescriptor.setDescription( mojoDescription ); mojoDescriptor.setPluginDescriptor( descriptor ); return mojoDescriptor; }