mirror of https://github.com/apache/maven.git
Make reporting plugin configuration always used (even if mojo in question is not a report), as in 2.0.x
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@592949 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
febce07c90
commit
ed568e725f
|
@ -23,7 +23,6 @@ import org.apache.maven.AggregatedBuildFailureException;
|
||||||
import org.apache.maven.BuildFailureException;
|
import org.apache.maven.BuildFailureException;
|
||||||
import org.apache.maven.NoGoalsSpecifiedException;
|
import org.apache.maven.NoGoalsSpecifiedException;
|
||||||
import org.apache.maven.ProjectBuildFailureException;
|
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.ArtifactNotFoundException;
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.context.BuildContextManager;
|
import org.apache.maven.context.BuildContextManager;
|
||||||
|
@ -84,8 +83,6 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private BuildPlanner buildPlanner;
|
private BuildPlanner buildPlanner;
|
||||||
|
|
||||||
private ArtifactHandlerManager artifactHandlerManager;
|
|
||||||
|
|
||||||
private MojoBindingFactory mojoBindingFactory;
|
private MojoBindingFactory mojoBindingFactory;
|
||||||
|
|
||||||
private BuildContextManager buildContextManager;
|
private BuildContextManager buildContextManager;
|
||||||
|
@ -768,8 +765,7 @@ public class DefaultLifecycleExecutor
|
||||||
MojoBinding binding = mojoBindingFactory.parseMojoBinding(
|
MojoBinding binding = mojoBindingFactory.parseMojoBinding(
|
||||||
task,
|
task,
|
||||||
project,
|
project,
|
||||||
true,
|
true );
|
||||||
false );
|
|
||||||
|
|
||||||
PluginDescriptor descriptor = pluginLoader.loadPlugin(
|
PluginDescriptor descriptor = pluginLoader.loadPlugin(
|
||||||
binding,
|
binding,
|
||||||
|
|
|
@ -199,7 +199,7 @@ final class BindingUtils
|
||||||
* Inject any plugin configuration available from the specified POM into the MojoBinding, after
|
* 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.
|
* 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 );
|
Map pluginMap = buildPluginMap( project );
|
||||||
|
|
||||||
|
@ -219,8 +219,6 @@ final class BindingUtils
|
||||||
|
|
||||||
Object configuration = mergeConfigurations( plugin, exec );
|
Object configuration = mergeConfigurations( plugin, exec );
|
||||||
|
|
||||||
if ( includeReportConfig )
|
|
||||||
{
|
|
||||||
ReportPlugin reportPlugin = (ReportPlugin) BindingUtils.buildReportPluginMap( project ).get( key );
|
ReportPlugin reportPlugin = (ReportPlugin) BindingUtils.buildReportPluginMap( project ).get( key );
|
||||||
if ( reportPlugin != null )
|
if ( reportPlugin != null )
|
||||||
{
|
{
|
||||||
|
@ -239,7 +237,6 @@ final class BindingUtils
|
||||||
// mojos or not.
|
// mojos or not.
|
||||||
configuration = mergeRawConfigurations( reportConfig, configuration );
|
configuration = mergeRawConfigurations( reportConfig, configuration );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
binding.setConfiguration( configuration );
|
binding.setConfiguration( configuration );
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,8 +276,7 @@ public class DefaultLifecycleBindingManager
|
||||||
* plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances.
|
* plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances.
|
||||||
*/
|
*/
|
||||||
public LifecycleBindings getPluginLifecycleOverlay( final PluginDescriptor pluginDescriptor,
|
public LifecycleBindings getPluginLifecycleOverlay( final PluginDescriptor pluginDescriptor,
|
||||||
final String lifecycleId, final MavenProject project,
|
final String lifecycleId, final MavenProject project )
|
||||||
final boolean includeReportConfig )
|
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
throws LifecycleLoaderException, LifecycleSpecificationException
|
||||||
{
|
{
|
||||||
Lifecycle lifecycleOverlay = null;
|
Lifecycle lifecycleOverlay = null;
|
||||||
|
@ -344,7 +343,7 @@ public class DefaultLifecycleBindingManager
|
||||||
MojoBinding binding;
|
MojoBinding binding;
|
||||||
if ( goal.indexOf( ":" ) > 0 )
|
if ( goal.indexOf( ":" ) > 0 )
|
||||||
{
|
{
|
||||||
binding = mojoBindingFactory.parseMojoBinding( goal, project, false, includeReportConfig );
|
binding = mojoBindingFactory.parseMojoBinding( goal, project, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -553,7 +552,7 @@ public class DefaultLifecycleBindingManager
|
||||||
binding.setExecutionId( id );
|
binding.setExecutionId( id );
|
||||||
binding.setOrigin( "POM" );
|
binding.setOrigin( "POM" );
|
||||||
|
|
||||||
BindingUtils.injectProjectConfiguration( binding, project, true );
|
BindingUtils.injectProjectConfiguration( binding, project );
|
||||||
|
|
||||||
reports.add( binding );
|
reports.add( binding );
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class DefaultMojoBindingFactory
|
||||||
* If a plugin-prefix is allowed and used, resolve the prefix and use the resulting PluginDescriptor
|
* 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.
|
* 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
|
throws LifecycleSpecificationException, LifecycleLoaderException
|
||||||
{
|
{
|
||||||
StringTokenizer tok = new StringTokenizer( bindingSpec, ":" );
|
StringTokenizer tok = new StringTokenizer( bindingSpec, ":" );
|
||||||
|
@ -61,7 +61,7 @@ public class DefaultMojoBindingFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
binding = createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
|
binding = createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
|
||||||
pluginDescriptor.getVersion(), tok.nextToken(), project, includeReportConfig );
|
pluginDescriptor.getVersion(), tok.nextToken(), project );
|
||||||
}
|
}
|
||||||
else if ( ( numTokens == 3 ) || ( numTokens == 4 ) )
|
else if ( ( numTokens == 3 ) || ( numTokens == 4 ) )
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ public class DefaultMojoBindingFactory
|
||||||
|
|
||||||
String goal = tok.nextToken();
|
String goal = tok.nextToken();
|
||||||
|
|
||||||
binding = createMojoBinding( groupId, artifactId, version, goal, project, includeReportConfig );
|
binding = createMojoBinding( groupId, artifactId, version, goal, project );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ public class DefaultMojoBindingFactory
|
||||||
* Create a new MojoBinding instance with the specified information, and inject POM configurations
|
* Create a new MojoBinding instance with the specified information, and inject POM configurations
|
||||||
* appropriate to that mojo before returning it.
|
* 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();
|
MojoBinding binding = new MojoBinding();
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class DefaultMojoBindingFactory
|
||||||
binding.setVersion( version );
|
binding.setVersion( version );
|
||||||
binding.setGoal( goal );
|
binding.setGoal( goal );
|
||||||
|
|
||||||
BindingUtils.injectProjectConfiguration( binding, project, includeReportConfig );
|
BindingUtils.injectProjectConfiguration( binding, project );
|
||||||
|
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class DefaultMojoBindingFactory
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return parseMojoBinding( bindingSpec, null, false, false );
|
return parseMojoBinding( bindingSpec, null, false );
|
||||||
}
|
}
|
||||||
catch ( LifecycleLoaderException e )
|
catch ( LifecycleLoaderException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ public interface LifecycleBindingManager
|
||||||
* plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances.
|
* plugin. Inject mojo configuration from the POM into all appropriate MojoBinding instances.
|
||||||
*/
|
*/
|
||||||
LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId,
|
LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId,
|
||||||
MavenProject project, boolean includeReportConfig )
|
MavenProject project )
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException;
|
throws LifecycleLoaderException, LifecycleSpecificationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,14 +23,14 @@ public interface MojoBindingFactory
|
||||||
* If a plugin-prefix is allowed and used, resolve the prefix and use the resulting PluginDescriptor
|
* 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.
|
* 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;
|
throws LifecycleSpecificationException, LifecycleLoaderException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new MojoBinding instance with the specified information, and inject POM configurations
|
* Create a new MojoBinding instance with the specified information, and inject POM configurations
|
||||||
* appropriate to that mojo before returning it.
|
* 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)}
|
* Simplified version of {@link MojoBindingFactory#parseMojoBinding(String, MavenProject, boolean)}
|
||||||
|
|
|
@ -78,9 +78,7 @@ public class DefaultBuildPlanner
|
||||||
|
|
||||||
if ( !LifecycleUtils.isValidPhaseName( task ) )
|
if ( !LifecycleUtils.isValidPhaseName( task ) )
|
||||||
{
|
{
|
||||||
logger.warn( "Assuming that mojo: \'" + task + "\' does NOT need configuration from the <reporting /> section of the POM." );
|
MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, true );
|
||||||
|
|
||||||
MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, true, false );
|
|
||||||
plan.addDirectInvocationBinding( task, binding );
|
plan.addDirectInvocationBinding( task, binding );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +288,7 @@ public class DefaultBuildPlanner
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
overlayBindings =
|
overlayBindings =
|
||||||
lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle, project, includeReportConfig );
|
lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle, project );
|
||||||
}
|
}
|
||||||
catch ( LifecycleLoaderException e )
|
catch ( LifecycleLoaderException e )
|
||||||
{
|
{
|
||||||
|
@ -343,7 +341,7 @@ public class DefaultBuildPlanner
|
||||||
|
|
||||||
MojoBinding binding =
|
MojoBinding binding =
|
||||||
mojoBindingFactory.createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
|
mojoBindingFactory.createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
|
||||||
pluginDescriptor.getVersion(), executeGoal, project, includeReportConfig );
|
pluginDescriptor.getVersion(), executeGoal, project );
|
||||||
|
|
||||||
binding.setOrigin( "Forked from " + referencingGoal );
|
binding.setOrigin( "Forked from " + referencingGoal );
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,13 @@ public class ResolveLateBoundPluginMojo extends AbstractMojo
|
||||||
|
|
||||||
private String goal;
|
private String goal;
|
||||||
|
|
||||||
private boolean includeReportConfig = false;
|
|
||||||
|
|
||||||
private MavenProject project;
|
private MavenProject project;
|
||||||
|
|
||||||
private MojoBindingFactory bindingFactory;
|
private MojoBindingFactory bindingFactory;
|
||||||
|
|
||||||
public void execute() throws MojoExecutionException, MojoFailureException
|
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
|
try
|
||||||
{
|
{
|
||||||
PluginDescriptor descriptor = pluginLoader.loadPlugin( binding, project );
|
PluginDescriptor descriptor = pluginLoader.loadPlugin( binding, project );
|
||||||
|
|
|
@ -162,13 +162,6 @@
|
||||||
<editable>true</editable>
|
<editable>true</editable>
|
||||||
<description>The mojo's goal that we're looking for, as an extra validation step.</description>
|
<description>The mojo's goal that we're looking for, as an extra validation step.</description>
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter>
|
|
||||||
<name>includeReportConfig</name>
|
|
||||||
<type>boolean</type>
|
|
||||||
<required>false</required>
|
|
||||||
<editable>true</editable>
|
|
||||||
<description>Whether the mojo should include plugin-configuration from the reporting section.</description>
|
|
||||||
</parameter>
|
|
||||||
</parameters>
|
</parameters>
|
||||||
<configuration>
|
<configuration>
|
||||||
<project implementation="org.apache.maven.project.MavenProject" default-value="${project}"/>
|
<project implementation="org.apache.maven.project.MavenProject" default-value="${project}"/>
|
||||||
|
@ -176,7 +169,6 @@
|
||||||
<artifactId implementation="java.lang.String">${artifactId}</artifactId>
|
<artifactId implementation="java.lang.String">${artifactId}</artifactId>
|
||||||
<version implementation="java.lang.String">${version}</version>
|
<version implementation="java.lang.String">${version}</version>
|
||||||
<goal implementation="java.lang.String">${goal}</goal>
|
<goal implementation="java.lang.String">${goal}</goal>
|
||||||
<includeReportConfig>false</includeReportConfig>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
<requirements>
|
<requirements>
|
||||||
<requirement>
|
<requirement>
|
||||||
|
|
|
@ -263,9 +263,6 @@ under the License.
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.plugin.PluginManager</role>
|
<role>org.apache.maven.plugin.PluginManager</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
|
||||||
<role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
|
|
||||||
</requirement>
|
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.lifecycle.plan.BuildPlanner</role>
|
<role>org.apache.maven.lifecycle.plan.BuildPlanner</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class DefaultMojoBindingFactoryTest
|
||||||
|
|
||||||
try
|
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." );
|
fail( "Should fail when prefix references are not allowed." );
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class DefaultMojoBindingFactoryTest
|
||||||
{
|
{
|
||||||
String spec = "group:artifact:goal";
|
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( "group", binding.getGroupId() );
|
||||||
assertEquals( "artifact", binding.getArtifactId() );
|
assertEquals( "artifact", binding.getArtifactId() );
|
||||||
|
@ -55,7 +55,7 @@ public class DefaultMojoBindingFactoryTest
|
||||||
{
|
{
|
||||||
String spec = "group:artifact:version:goal";
|
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( "group", binding.getGroupId() );
|
||||||
assertEquals( "artifact", binding.getArtifactId() );
|
assertEquals( "artifact", binding.getArtifactId() );
|
||||||
|
@ -70,7 +70,7 @@ public class DefaultMojoBindingFactoryTest
|
||||||
|
|
||||||
try
|
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)." );
|
fail( "Should fail because spec has too many parts (type part is not allowed)." );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue