PR: MNG-285

fix bug in plugin management inheritence


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-15 06:16:47 +00:00
parent 8ace38fbce
commit 912898c716
2 changed files with 7 additions and 33 deletions

View File

@ -16,32 +16,25 @@ package org.apache.maven.lifecycle;
* limitations under the License.
*/
import org.apache.maven.MavenConstants;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Goal;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.PluginExecutionException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.DefaultMavenProjectBuilder;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@ -55,7 +48,7 @@ import java.util.Map;
*/
public class DefaultLifecycleExecutor
extends AbstractLogEnabled
implements LifecycleExecutor, Initializable
implements LifecycleExecutor
{
// ----------------------------------------------------------------------
// Components
@ -71,9 +64,6 @@ public class DefaultLifecycleExecutor
private List phases;
// TODO: remove
private Model superModel;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@ -192,20 +182,6 @@ public class DefaultLifecycleExecutor
project = project.getParent();
}
if ( plugin.getVersion() == null )
{
PluginManagement pluginManagement = superModel.getBuild().getPluginManagement();
if ( pluginManagement != null )
{
Plugin management = findPlugin( pluginManagement.getPlugins(), groupId, artifactId );
if ( management != null && management.getVersion() != null )
{
plugin.setVersion( management.getVersion() );
}
}
}
if ( plugin.getVersion() == null )
{
// TODO: this has probably supplanted the default in the plugin manager
@ -454,11 +430,4 @@ public class DefaultLifecycleExecutor
return phases;
}
public void initialize()
throws Exception
{
// TODO: get rid of this and the interface...
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MavenConstants.MAVEN_MODEL_VERSION + ".xml" );
superModel = new MavenXpp3Reader().read( new InputStreamReader( url.openStream() ) );
}
}

View File

@ -201,7 +201,7 @@ public class DefaultModelInheritanceAssembler
private void assemblePluginManagementInheritance( Model child, Model parent )
{
Build parentBuild = parent.getBuild();
Build childBuild = parent.getBuild();
Build childBuild = child.getBuild();
if ( childBuild == null )
{
@ -248,6 +248,11 @@ public class DefaultModelInheritanceAssembler
{
Plugin childPlugin = (Plugin) mappedChildPlugins.get( constructPluginKey( plugin ) );
if ( childPlugin.getVersion() == null )
{
childPlugin.setVersion( childPlugin.getVersion() );
}
Map mappedChildGoals = new TreeMap();
for ( Iterator itGoals = childPlugin.getGoals().iterator(); itGoals.hasNext(); )
{