[
https://issues.apache.org/jira/browse/MNG-7468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537398#comment-17537398
]
ASF GitHub Bot commented on MNG-7468:
-------------------------------------
MartinKanters commented on code in PR #741:
URL: https://github.com/apache/maven/pull/741#discussion_r873452132
##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java:
##########
@@ -358,6 +368,61 @@ private void finalizeMojoConfiguration( MojoExecution
mojoExecution )
mojoExecution.setConfiguration( finalConfiguration );
}
+ private void checkUnKnownMojoConfigurationParameters( MojoExecution
mojoExecution )
+ throws PluginConfigurationException
+ {
+ if ( mojoExecution.getConfiguration() == null ||
mojoExecution.getConfiguration().getChildCount() == 0 )
+ {
+ return;
+ }
+
+ // first stem get parameter names of current goal
+ Set<String> parametersNames = new HashSet<>();
+ for ( Parameter p : mojoExecution.getMojoDescriptor().getParameters() )
Review Comment:
I unfortunately do not have the time to do a proper review, but I noticed
some things at a glance:
- I believe this for loop and the one on line 404 is the same. Have you
considered refactoring that to a method?
- If you do the first point, then this method can all be done in a couple of
streams instead of for-loops alternated with streams. Could be a small styling
benefit.
- typo in the comment on line 379 (step*)
-
##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java:
##########
@@ -358,6 +368,61 @@ private void finalizeMojoConfiguration( MojoExecution
mojoExecution )
mojoExecution.setConfiguration( finalConfiguration );
}
+ private void checkUnKnownMojoConfigurationParameters( MojoExecution
mojoExecution )
+ throws PluginConfigurationException
+ {
+ if ( mojoExecution.getConfiguration() == null ||
mojoExecution.getConfiguration().getChildCount() == 0 )
+ {
+ return;
+ }
+
+ // first stem get parameter names of current goal
+ Set<String> parametersNames = new HashSet<>();
+ for ( Parameter p : mojoExecution.getMojoDescriptor().getParameters() )
Review Comment:
I unfortunately do not have the time to do a proper review, but I noticed
some things at a glance:
- I believe this for loop and the one on line 404 is the same. Have you
considered refactoring that to a method?
- If you do the first point, then this method can all be done in a couple of
streams instead of for-loops alternated with streams. Could be a small styling
benefit.
- typo in the comment on line 379 (step*)
> Unsupported plugins parameters in configuration should be verified
> ------------------------------------------------------------------
>
> Key: MNG-7468
> URL: https://issues.apache.org/jira/browse/MNG-7468
> Project: Maven
> Issue Type: New Feature
> Components: Plugins and Lifecycle
> Reporter: Slawomir Jaranowski
> Assignee: Slawomir Jaranowski
> Priority: Major
> Fix For: 3.9.0, 4.0.0-alpha-1, 4.0.0
>
>
> Currently we can provide any xml tags in plugin configuration even if plugin
> Mojo doesn't support specific parameters.
> eg we can have:
> {code:xml}
> <plugin>
> <artifactId>example-maven-plugin</artifactId>
> <version>1.1.1</version>
> <configuration>
> <xxx>zzzz</xxx>
> </configuration>
> </plugin>
> {code}
> With example configuration Mojo is executed without any warning.
> Simply if parameters is not supported - build should break with some of
> invalid plugin configuration exception ...
--
This message was sent by Atlassian Jira
(v8.20.7#820007)