Revert "[MNG-6562] added WARNING on default bindings plugins unlocked versions"

This reverts commit d9bf929c74.
This commit is contained in:
rfscholte 2020-06-19 17:28:01 +02:00
parent c4ad91e6b9
commit 958380685d
1 changed files with 5 additions and 31 deletions

View File

@ -22,7 +22,6 @@ package org.apache.maven.model.plugin;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -79,7 +78,7 @@ public class DefaultLifecycleBindingsInjector
lifecycleModel.setBuild( new Build() );
lifecycleModel.getBuild().getPlugins().addAll( defaultPlugins );
merger.merge( model, lifecycleModel, problems );
merger.merge( model, lifecycleModel );
}
}
@ -91,36 +90,18 @@ public class DefaultLifecycleBindingsInjector
{
private static final String PLUGIN_MANAGEMENT = "plugin-management";
private static final String NO_VERSION_PLUGINS = "no-version-plugins";
public void merge( Model target, Model source, ModelProblemCollector problems )
public void merge( Model target, Model source )
{
if ( target.getBuild() == null )
{
target.setBuild( new Build() );
}
Map<Object, Object> context = new HashMap<Object, Object>();
context.put( PLUGIN_MANAGEMENT, target.getBuild().getPluginManagement() );
Map<Object, Object> context =
Collections.<Object, Object>singletonMap( PLUGIN_MANAGEMENT, target.getBuild().getPluginManagement() );
mergePluginContainer_Plugins( target.getBuild(), source.getBuild(), false, context );
@SuppressWarnings( "unchecked" )
Collection<Plugin> defaultVersionPlugins = (Collection<Plugin>) context.get( NO_VERSION_PLUGINS );
if ( defaultVersionPlugins != null )
{
List<String> plugins = new ArrayList<>( defaultVersionPlugins.size() );
for ( Plugin p : defaultVersionPlugins )
{
plugins.add( p.getArtifactId() );
}
problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE )
.setMessage( "Version not locked for default bindings plugins " + plugins
+ ", you should define versions in pluginManagement section of your "
+ "pom.xml or parent" )
.setLocation( target.getLocation( "packaging" ) ) );
}
}
@SuppressWarnings( { "checkstyle:methodname" } )
@ -166,8 +147,7 @@ public class DefaultLifecycleBindingsInjector
for ( Plugin managedPlugin : pluginMgmt.getPlugins() )
{
Object key = getPluginKey().apply( managedPlugin );
Plugin addedPlugin = // remove plugin only if managedPlugin defines version
( managedPlugin.getVersion() == null ) ? added.get( key ) : added.remove( key );
Plugin addedPlugin = added.get( key );
if ( addedPlugin != null )
{
Plugin plugin = managedPlugin.clone();
@ -176,12 +156,6 @@ public class DefaultLifecycleBindingsInjector
}
}
}
if ( !added.isEmpty() )
{
// some plugins added with default version from bindings
context.put( NO_VERSION_PLUGINS, added.values() );
}
}
List<Plugin> result = new ArrayList<>( merged.values() );