slawekjaranowski commented on code in PR #741:
URL: https://github.com/apache/maven/pull/741#discussion_r882871821
##########
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() );
+
+ unknownParameters = getUnknownParameters( mojoExecution,
parametersNamesAll );
+
+ unknownParameters.forEach(
+ name ->
+ {
+ MessageBuilder messageBuilder = MessageUtils.buffer()
+ .warning( "Parameter '" )
+ .warning( name )
+ .warning( "' is unknown for plugin: '" )
+ .warning( mojoExecution.getArtifactId() ).warning( ":" )
+ .warning( mojoExecution.getVersion() ).warning( ":" )
+ .warning( mojoExecution.getGoal() );
Review Comment:
example message will be:
```
[WARNING] Parameter 'invalidValue' is unknown for plugin
`maven-it-plugin-configuration:2.1-SNAPSHOT:touch (default)`
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]