From b3e7e57e4bc20c5c387fb1712be07847043bef9a Mon Sep 17 00:00:00 2001 From: Slawomir Jaranowski Date: Sun, 19 Jun 2022 22:07:04 +0200 Subject: [PATCH] [MNG-7504] Don't print warning unsupported reportPlugins for m-site-p --- .../DefaultMojoExecutionConfigurator.java | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java index 94fbf92cb4..e655360d35 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java @@ -156,28 +156,37 @@ public class DefaultMojoExecutionConfigurator 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() ); - - if ( mojoExecution.getExecutionId() != null ) + unknownParameters.stream() + .filter( parameterName -> isNotReportPluginsForMavenSite( parameterName, mojoExecution ) ) + .forEach( + name -> { - messageBuilder.warning( " (" ); - messageBuilder.warning( mojoExecution.getExecutionId() ); - messageBuilder.warning( ")" ); - } + MessageBuilder messageBuilder = MessageUtils.buffer() + .warning( "Parameter '" ) + .warning( name ) + .warning( "' is unknown for plugin '" ) + .warning( mojoExecution.getArtifactId() ).warning( ":" ) + .warning( mojoExecution.getVersion() ).warning( ":" ) + .warning( mojoExecution.getGoal() ); - messageBuilder.warning( "'" ); + if ( mojoExecution.getExecutionId() != null ) + { + messageBuilder.warning( " (" ); + messageBuilder.warning( mojoExecution.getExecutionId() ); + messageBuilder.warning( ")" ); + } - logger.warn( messageBuilder.toString() ); - } ); + messageBuilder.warning( "'" ); + + logger.warn( messageBuilder.toString() ); + } ); + } + + private boolean isNotReportPluginsForMavenSite( String parameterName, + MojoExecution mojoExecution ) + { + return !( "reportPlugins".equals( parameterName ) + && "maven-site-plugin".equals( mojoExecution.getArtifactId() ) ); } private Stream getParameterNames( Parameter parameter )