mirror of https://github.com/apache/maven.git
Fixing CI. Had to move the addPlugin(..) call back to its original spot, and expose a new method in MavenProject to inject PluginManagement info to a Plugin instance that's passed in as a parameter.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@344294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
adefb99e33
commit
eb1651be3c
|
@ -1351,15 +1351,17 @@ public class DefaultLifecycleExecutor
|
|||
throw new BuildFailureException( message );
|
||||
}
|
||||
|
||||
// this has been simplified from the old code that injected the plugin management stuff, since
|
||||
// pluginManagement injection is now handled by the project method.
|
||||
project.addPlugin( plugin );
|
||||
|
||||
project.injectPluginManagementInfo( plugin );
|
||||
|
||||
if ( pluginDescriptor == null )
|
||||
{
|
||||
pluginDescriptor = verifyPlugin( plugin, project, session.getSettings(), session.getLocalRepository() );
|
||||
}
|
||||
|
||||
// this has been simplified from the old code that injected the plugin management stuff, since
|
||||
// pluginManagement injection is now handled by the project method.
|
||||
project.addPlugin( plugin );
|
||||
|
||||
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
|
||||
if ( mojoDescriptor == null )
|
||||
{
|
||||
|
|
|
@ -917,7 +917,7 @@ public class MavenProject
|
|||
{
|
||||
if ( buildOverlay == null )
|
||||
{
|
||||
buildOverlay = new BuildOverlay( model.getBuild() );
|
||||
buildOverlay = new BuildOverlay( getModelBuild() );
|
||||
}
|
||||
|
||||
return buildOverlay;
|
||||
|
@ -1112,8 +1112,8 @@ public class MavenProject
|
|||
|
||||
return pluginMgmt;
|
||||
}
|
||||
|
||||
public void addPlugin( Plugin plugin )
|
||||
|
||||
private Build getModelBuild()
|
||||
{
|
||||
Build build = model.getBuild();
|
||||
|
||||
|
@ -1123,30 +1123,41 @@ public class MavenProject
|
|||
|
||||
model.setBuild( build );
|
||||
}
|
||||
|
||||
return build;
|
||||
}
|
||||
|
||||
public void addPlugin( Plugin plugin )
|
||||
{
|
||||
Build build = getModelBuild();
|
||||
|
||||
if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) )
|
||||
{
|
||||
PluginManagement pm = build.getPluginManagement();
|
||||
|
||||
if ( pm != null )
|
||||
{
|
||||
Map pmByKey = pm.getPluginsAsMap();
|
||||
|
||||
String pluginKey = plugin.getKey();
|
||||
|
||||
if ( pmByKey != null && pmByKey.containsKey( pluginKey ) )
|
||||
{
|
||||
Plugin pmPlugin = (Plugin) pmByKey.get( pluginKey );
|
||||
|
||||
ModelUtils.mergePluginDefinitions( plugin, pmPlugin, false );
|
||||
}
|
||||
|
||||
}
|
||||
injectPluginManagementInfo( plugin );
|
||||
|
||||
build.addPlugin( plugin );
|
||||
build.flushPluginMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void injectPluginManagementInfo( Plugin plugin )
|
||||
{
|
||||
PluginManagement pm = getModelBuild().getPluginManagement();
|
||||
|
||||
if ( pm != null )
|
||||
{
|
||||
Map pmByKey = pm.getPluginsAsMap();
|
||||
|
||||
String pluginKey = plugin.getKey();
|
||||
|
||||
if ( pmByKey != null && pmByKey.containsKey( pluginKey ) )
|
||||
{
|
||||
Plugin pmPlugin = (Plugin) pmByKey.get( pluginKey );
|
||||
|
||||
ModelUtils.mergePluginDefinitions( plugin, pmPlugin, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List getCollectedProjects()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue