mirror of https://github.com/apache/maven.git
Need to override lifecycle plugin versions if there is a pluginMng entry for it.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@770454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
383a8b006a
commit
93cff78fbf
|
@ -194,11 +194,7 @@ public class DefaultMavenProjectBuilder
|
|||
Set<Plugin> pl = lifecycle.populateDefaultConfigurationForPlugins(new HashSet<Plugin>(pln),
|
||||
project, configuration.getLocalRepository());
|
||||
/*
|
||||
if(model.getArtifactId() != null &&
|
||||
model.getArtifactId().equals("maven-model"))
|
||||
{
|
||||
System.out.println(new DomainModel(project.getModel()).asString());
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
for (Plugin buildPlugin : pl) {
|
||||
|
@ -225,7 +221,13 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
}
|
||||
project.getModel().getBuild().setPlugins(new ArrayList<Plugin>(pl));
|
||||
|
||||
/*
|
||||
if(model.getArtifactId() != null &&
|
||||
model.getArtifactId().equals("maven-model"))
|
||||
{
|
||||
System.out.println(new DomainModel(project.getModel()).asString());
|
||||
}
|
||||
*/
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -277,24 +279,35 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
public static void addPluginsToModel(Model target, Set<Plugin> plugins)
|
||||
{
|
||||
List<Plugin> mPlugins = new ArrayList<Plugin>(target.getBuild().getPlugins());
|
||||
List<Plugin> mngPlugins = (target.getBuild().getPluginManagement() != null)
|
||||
? target.getBuild().getPluginManagement().getPlugins() : new ArrayList<Plugin>();
|
||||
|
||||
List<Plugin> pomPlugins = new ArrayList<Plugin>(target.getBuild().getPlugins());
|
||||
|
||||
List<Plugin> lifecyclePlugins = new ArrayList<Plugin>();
|
||||
|
||||
for( Plugin p : plugins )
|
||||
{
|
||||
Plugin mPlugin = containsPlugin( p, mPlugins);
|
||||
if( mPlugin == null)
|
||||
//Go ahead and add version if exists in pluginManagement - don't use default version
|
||||
Plugin mngPlugin = containsPlugin(p, mngPlugins);
|
||||
if(mngPlugin != null && mngPlugin.getVersion() != null)
|
||||
{
|
||||
//System.out.println("Set version:" + p.getVersion() + ": To = " + mngPlugin.getVersion());
|
||||
p.setVersion(mngPlugin.getVersion());
|
||||
}
|
||||
|
||||
Plugin pomPlugin = containsPlugin( p, pomPlugins);
|
||||
if( pomPlugin == null)
|
||||
{
|
||||
lifecyclePlugins.add(p);
|
||||
}
|
||||
else if(p.getConfiguration() != null)
|
||||
{
|
||||
System.out.println(Xpp3Dom.mergeXpp3Dom((Xpp3Dom) p.getConfiguration(), (Xpp3Dom) mPlugin.getConfiguration()));
|
||||
System.out.println(Xpp3Dom.mergeXpp3Dom((Xpp3Dom) p.getConfiguration(), (Xpp3Dom) pomPlugin.getConfiguration()));
|
||||
}
|
||||
}
|
||||
mPlugins.addAll(lifecyclePlugins);
|
||||
target.getBuild().setPlugins(mPlugins);
|
||||
pomPlugins.addAll(lifecyclePlugins);
|
||||
target.getBuild().setPlugins(pomPlugins);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue