From 1a1df66bfb0241a296f766bc8e4d4f708f69c9ab Mon Sep 17 00:00:00 2001 From: Yueh Chun Wu Date: Thu, 16 May 2024 22:03:26 -0700 Subject: [PATCH 1/3] [MNG-7902] Sort plugins in the validation report --- .../DefaultPluginValidationManager.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java index 0794a548f716..a20f9bf69ac3 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java @@ -23,17 +23,7 @@ import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -203,7 +193,7 @@ public void reportPluginMojoValidationIssue( mayReportInline(mavenSession.getRepositorySession(), locality, issue); } - private void reportSessionCollectedValidationIssues(MavenSession mavenSession) { + public void reportSessionCollectedValidationIssues(MavenSession mavenSession) { if (!logger.isWarnEnabled()) { return; // nothing can be reported } @@ -222,7 +212,12 @@ private void reportSessionCollectedValidationIssues(MavenSession mavenSession) { logger.warn(""); logger.warn("Plugin {} validation issues were detected in following plugin(s)", issueLocalitiesToReport); logger.warn(""); - for (Map.Entry entry : issuesMap.entrySet()) { + + // Sorting the plugins (Fix the open issue) + List> sortedEntries = new ArrayList<>(issuesMap.entrySet()); + sortedEntries.sort(Map.Entry.comparingByKey(String.CASE_INSENSITIVE_ORDER)); + + for (Map.Entry entry : sortedEntries) { PluginValidationIssues issues = entry.getValue(); if (!hasAnythingToReport(issues, issueLocalitiesToReport)) { continue; From 3f9baa55d0aa1f33cd601b58a44dffcd4a83b0b1 Mon Sep 17 00:00:00 2001 From: Yueh Chun Wu Date: Wed, 22 May 2024 14:57:57 -0700 Subject: [PATCH 2/3] [MNG-7902] Sort plugins in the validation report remove * from import statements and remove unnecessary comment --- .../internal/DefaultPluginValidationManager.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java index a20f9bf69ac3..a3aff36611c5 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java @@ -23,7 +23,18 @@ import java.nio.file.Path; import java.nio.file.Paths; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; @@ -213,7 +224,7 @@ public void reportSessionCollectedValidationIssues(MavenSession mavenSession) { logger.warn("Plugin {} validation issues were detected in following plugin(s)", issueLocalitiesToReport); logger.warn(""); - // Sorting the plugins (Fix the open issue) + // Sorting the plugins List> sortedEntries = new ArrayList<>(issuesMap.entrySet()); sortedEntries.sort(Map.Entry.comparingByKey(String.CASE_INSENSITIVE_ORDER)); From 32f9d3af1fdc0093ec08a4ece91254b8fc0d7ba0 Mon Sep 17 00:00:00 2001 From: Yueh Chun Wu Date: Wed, 22 May 2024 15:15:10 -0700 Subject: [PATCH 3/3] [MNG-7902] Sort plugins in the validation report Incorrect visibility change --- .../maven/plugin/internal/DefaultPluginValidationManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java index a3aff36611c5..cf15292df8df 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginValidationManager.java @@ -204,7 +204,7 @@ public void reportPluginMojoValidationIssue( mayReportInline(mavenSession.getRepositorySession(), locality, issue); } - public void reportSessionCollectedValidationIssues(MavenSession mavenSession) { + private void reportSessionCollectedValidationIssues(MavenSession mavenSession) { if (!logger.isWarnEnabled()) { return; // nothing can be reported }