slawekjaranowski commented on code in PR #741:
URL: https://github.com/apache/maven/pull/741#discussion_r882879288


##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java:
##########
@@ -108,4 +122,75 @@ private PluginExecution findPluginExecution( String 
executionId, Collection<Plug
         return null;
     }
 
+    private void checkUnKnownMojoConfigurationParameters( MojoExecution 
mojoExecution )
+    {
+        if ( mojoExecution.getConfiguration() == null || 
mojoExecution.getConfiguration().getChildCount() == 0 )
+        {
+            return;
+        }
+
+        MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+        // in first step get parameter names of current goal
+        Set<String> parametersNamesGoal = 
mojoDescriptor.getParameters().stream()
+            .flatMap( this::getParameterNames )
+            .collect( Collectors.toSet() );
+
+        Set<String> unknownParameters = getUnknownParameters( mojoExecution, 
parametersNamesGoal );
+
+        if ( unknownParameters.isEmpty() )
+        {
+            return;
+        }
+
+        // second step get parameter names of all plugin goals
+        Set<String> parametersNamesAll = 
mojoDescriptor.getPluginDescriptor().getMojos().stream()
+            .flatMap( m -> m.getParameters().stream() )
+            .flatMap( this::getParameterNames )
+            .collect( Collectors.toSet() );

Review Comment:
   One plugin can have many goals with different parameters list.
   This checking is done in context with specific goal, but configuration can 
have parameters for other goals.
   I simply check if given parameters is valid for any goal in plugin.
   Even parameters can be provided for goal which will be executed only be cli.
   



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to