michael-o commented on a change in pull request #233: [MNG-6562] added WARNING 
on default bindings plugins unlocked versions
URL: https://github.com/apache/maven/pull/233#discussion_r292143735
 
 

 ##########
 File path: 
maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java
 ##########
 @@ -87,18 +88,36 @@ else if ( !defaultPlugins.isEmpty() )
     {
 
         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 )
+        public void merge( Model target, Model source, ModelProblemCollector 
problems )
         {
             if ( target.getBuild() == null )
             {
                 target.setBuild( new Build() );
             }
 
-            Map<Object, Object> context =
-                Collections.<Object, Object>singletonMap( PLUGIN_MANAGEMENT, 
target.getBuild().getPluginManagement() );
+            Map<Object, Object> context = new HashMap<Object, Object>();
+            context.put( 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" )
 
 Review comment:
   that should be consistent too: ... your POM or parent POM. I'd avoid 
`pom.xml` for polyglot Maven.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to