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:
John Dennis Casey 2005-11-15 02:38:33 +00:00
parent adefb99e33
commit eb1651be3c
2 changed files with 36 additions and 23 deletions

View File

@ -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 )
{

View File

@ -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()
{