diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index b95a21ce26..3d92406ff1 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -23,7 +23,6 @@ import org.apache.maven.AggregatedBuildFailureException; import org.apache.maven.BuildFailureException; import org.apache.maven.NoGoalsSpecifiedException; import org.apache.maven.ProjectBuildFailureException; -import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.context.BuildContextManager; @@ -84,8 +83,6 @@ public class DefaultLifecycleExecutor private BuildPlanner buildPlanner; - private ArtifactHandlerManager artifactHandlerManager; - private MojoBindingFactory mojoBindingFactory; private BuildContextManager buildContextManager; @@ -768,8 +765,7 @@ public class DefaultLifecycleExecutor MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, - true, - false ); + true ); PluginDescriptor descriptor = pluginLoader.loadPlugin( binding, diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java index 4e70fc99d3..151c0991c7 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java @@ -199,7 +199,7 @@ final class BindingUtils * Inject any plugin configuration available from the specified POM into the MojoBinding, after * first merging in the applicable configuration from the POM's pluginManagement section. */ - static void injectProjectConfiguration( MojoBinding binding, MavenProject project, boolean includeReportConfig ) + static void injectProjectConfiguration( MojoBinding binding, MavenProject project ) { Map pluginMap = buildPluginMap( project ); @@ -219,26 +219,23 @@ final class BindingUtils Object configuration = mergeConfigurations( plugin, exec ); - if ( includeReportConfig ) + ReportPlugin reportPlugin = (ReportPlugin) BindingUtils.buildReportPluginMap( project ).get( key ); + if ( reportPlugin != null ) { - ReportPlugin reportPlugin = (ReportPlugin) BindingUtils.buildReportPluginMap( project ).get( key ); - if ( reportPlugin != null ) + Map reportSets = reportPlugin.getReportSetsAsMap(); + + ReportSet reportSet = null; + if ( ( reportSets != null ) && ( exec != null ) ) { - Map reportSets = reportPlugin.getReportSetsAsMap(); - - ReportSet reportSet = null; - if ( ( reportSets != null ) && ( exec != null ) ) - { - reportSet = (ReportSet) reportSets.get( exec.getId() ); - } - - Object reportConfig = BindingUtils.mergeConfigurations( reportPlugin, reportSet ); - - // NOTE: This looks weird, but we must retain some consistency with - // dominance of plugin configs, regardless of whether they're report - // mojos or not. - configuration = mergeRawConfigurations( reportConfig, configuration ); + reportSet = (ReportSet) reportSets.get( exec.getId() ); } + + Object reportConfig = BindingUtils.mergeConfigurations( reportPlugin, reportSet ); + + // NOTE: This looks weird, but we must retain some consistency with + // dominance of plugin configs, regardless of whether they're report + // mojos or not. + configuration = mergeRawConfigurations( reportConfig, configuration ); } binding.setConfiguration( configuration ); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java index 8fde367184..cb3fa3791f 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java @@ -276,8 +276,7 @@ public class DefaultLifecycleBindingManager * plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances. */ public LifecycleBindings getPluginLifecycleOverlay( final PluginDescriptor pluginDescriptor, - final String lifecycleId, final MavenProject project, - final boolean includeReportConfig ) + final String lifecycleId, final MavenProject project ) throws LifecycleLoaderException, LifecycleSpecificationException { Lifecycle lifecycleOverlay = null; @@ -344,7 +343,7 @@ public class DefaultLifecycleBindingManager MojoBinding binding; if ( goal.indexOf( ":" ) > 0 ) { - binding = mojoBindingFactory.parseMojoBinding( goal, project, false, includeReportConfig ); + binding = mojoBindingFactory.parseMojoBinding( goal, project, false ); } else { @@ -553,7 +552,7 @@ public class DefaultLifecycleBindingManager binding.setExecutionId( id ); binding.setOrigin( "POM" ); - BindingUtils.injectProjectConfiguration( binding, project, true ); + BindingUtils.injectProjectConfiguration( binding, project ); reports.add( binding ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java index e596547dfd..1794cb1d06 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java @@ -28,7 +28,7 @@ public class DefaultMojoBindingFactory * If a plugin-prefix is allowed and used, resolve the prefix and use the resulting PluginDescriptor * to set groupId and artifactId on the MojoBinding instance. */ - public MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference, boolean includeReportConfig ) + public MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference ) throws LifecycleSpecificationException, LifecycleLoaderException { StringTokenizer tok = new StringTokenizer( bindingSpec, ":" ); @@ -61,7 +61,7 @@ public class DefaultMojoBindingFactory } binding = createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), - pluginDescriptor.getVersion(), tok.nextToken(), project, includeReportConfig ); + pluginDescriptor.getVersion(), tok.nextToken(), project ); } else if ( ( numTokens == 3 ) || ( numTokens == 4 ) ) { @@ -78,7 +78,7 @@ public class DefaultMojoBindingFactory String goal = tok.nextToken(); - binding = createMojoBinding( groupId, artifactId, version, goal, project, includeReportConfig ); + binding = createMojoBinding( groupId, artifactId, version, goal, project ); } else { @@ -95,7 +95,7 @@ public class DefaultMojoBindingFactory * Create a new MojoBinding instance with the specified information, and inject POM configurations * appropriate to that mojo before returning it. */ - public MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project, boolean includeReportConfig ) + public MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project ) { MojoBinding binding = new MojoBinding(); @@ -104,7 +104,7 @@ public class DefaultMojoBindingFactory binding.setVersion( version ); binding.setGoal( goal ); - BindingUtils.injectProjectConfiguration( binding, project, includeReportConfig ); + BindingUtils.injectProjectConfiguration( binding, project ); return binding; } @@ -119,7 +119,7 @@ public class DefaultMojoBindingFactory { try { - return parseMojoBinding( bindingSpec, null, false, false ); + return parseMojoBinding( bindingSpec, null, false ); } catch ( LifecycleLoaderException e ) { diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java index 3eefd40291..4c0bf7efcc 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java @@ -45,7 +45,7 @@ public interface LifecycleBindingManager * plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances. */ LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId, - MavenProject project, boolean includeReportConfig ) + MavenProject project ) throws LifecycleLoaderException, LifecycleSpecificationException; /** diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java index 3d216fdbb8..b7b235bc70 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java @@ -23,14 +23,14 @@ public interface MojoBindingFactory * If a plugin-prefix is allowed and used, resolve the prefix and use the resulting PluginDescriptor * to set groupId and artifactId on the MojoBinding instance. */ - MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference, boolean includeReportConfig ) + MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference ) throws LifecycleSpecificationException, LifecycleLoaderException; /** * Create a new MojoBinding instance with the specified information, and inject POM configurations * appropriate to that mojo before returning it. */ - MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project, boolean includeReportConfig ); + MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project ); /** * Simplified version of {@link MojoBindingFactory#parseMojoBinding(String, MavenProject, boolean)} diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java index ce8f5569f5..4b406f7ee9 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java @@ -78,9 +78,7 @@ public class DefaultBuildPlanner if ( !LifecycleUtils.isValidPhaseName( task ) ) { - logger.warn( "Assuming that mojo: \'" + task + "\' does NOT need configuration from the section of the POM." ); - - MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, true, false ); + MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, true ); plan.addDirectInvocationBinding( task, binding ); } } @@ -290,7 +288,7 @@ public class DefaultBuildPlanner try { overlayBindings = - lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle, project, includeReportConfig ); + lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle, project ); } catch ( LifecycleLoaderException e ) { @@ -343,7 +341,7 @@ public class DefaultBuildPlanner MojoBinding binding = mojoBindingFactory.createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(), - pluginDescriptor.getVersion(), executeGoal, project, includeReportConfig ); + pluginDescriptor.getVersion(), executeGoal, project ); binding.setOrigin( "Forked from " + referencingGoal ); diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/ResolveLateBoundPluginMojo.java b/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/ResolveLateBoundPluginMojo.java index 924996d9fb..7ff3e6d811 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/ResolveLateBoundPluginMojo.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/ResolveLateBoundPluginMojo.java @@ -28,15 +28,13 @@ public class ResolveLateBoundPluginMojo extends AbstractMojo private String goal; - private boolean includeReportConfig = false; - private MavenProject project; private MojoBindingFactory bindingFactory; public void execute() throws MojoExecutionException, MojoFailureException { - MojoBinding binding = bindingFactory.createMojoBinding( groupId, artifactId, version, artifactId, project, includeReportConfig ); + MojoBinding binding = bindingFactory.createMojoBinding( groupId, artifactId, version, artifactId, project ); try { PluginDescriptor descriptor = pluginLoader.loadPlugin( binding, project ); diff --git a/maven-core/src/main/resources/META-INF/maven/plugin.xml b/maven-core/src/main/resources/META-INF/maven/plugin.xml index 6a912e154c..2b5e99c45c 100644 --- a/maven-core/src/main/resources/META-INF/maven/plugin.xml +++ b/maven-core/src/main/resources/META-INF/maven/plugin.xml @@ -162,13 +162,6 @@ true The mojo's goal that we're looking for, as an extra validation step. - - includeReportConfig - boolean - false - true - Whether the mojo should include plugin-configuration from the reporting section. - @@ -176,7 +169,6 @@ ${artifactId} ${version} ${goal} - false diff --git a/maven-core/src/main/resources/META-INF/plexus/components.xml b/maven-core/src/main/resources/META-INF/plexus/components.xml index 47197595f0..42c15936f1 100644 --- a/maven-core/src/main/resources/META-INF/plexus/components.xml +++ b/maven-core/src/main/resources/META-INF/plexus/components.xml @@ -263,9 +263,6 @@ under the License. org.apache.maven.plugin.PluginManager - - org.apache.maven.artifact.handler.manager.ArtifactHandlerManager - org.apache.maven.lifecycle.plan.BuildPlanner diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactoryTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactoryTest.java index e8271faf5c..468fb3483e 100644 --- a/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactoryTest.java +++ b/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactoryTest.java @@ -27,7 +27,7 @@ public class DefaultMojoBindingFactoryTest try { - factory.parseMojoBinding( spec, new MavenProject( new Model() ), false, false ); + factory.parseMojoBinding( spec, new MavenProject( new Model() ), false ); fail( "Should fail when prefix references are not allowed." ); } @@ -42,7 +42,7 @@ public class DefaultMojoBindingFactoryTest { String spec = "group:artifact:goal"; - MojoBinding binding = factory.parseMojoBinding( spec, new MavenProject( new Model() ), false, false ); + MojoBinding binding = factory.parseMojoBinding( spec, new MavenProject( new Model() ), false ); assertEquals( "group", binding.getGroupId() ); assertEquals( "artifact", binding.getArtifactId() ); @@ -55,7 +55,7 @@ public class DefaultMojoBindingFactoryTest { String spec = "group:artifact:version:goal"; - MojoBinding binding = factory.parseMojoBinding( spec, new MavenProject( new Model() ), false, false ); + MojoBinding binding = factory.parseMojoBinding( spec, new MavenProject( new Model() ), false ); assertEquals( "group", binding.getGroupId() ); assertEquals( "artifact", binding.getArtifactId() ); @@ -70,7 +70,7 @@ public class DefaultMojoBindingFactoryTest try { - factory.parseMojoBinding( spec, new MavenProject( new Model() ), false, false ); + factory.parseMojoBinding( spec, new MavenProject( new Model() ), false ); fail( "Should fail because spec has too many parts (type part is not allowed)." ); }