This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 505d612 [MPH-201] Use only what we need from maven-plugin-tools-generators 505d612 is described below commit 505d6120756dff347db250534a44235cce2d93b8 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Mar 11 11:56:57 2023 +0100 [MPH-201] Use only what we need from maven-plugin-tools-generators Replace deprecated method GeneratorUtils.toText by HtmlToPlainTextConverter So we only need one class HtmlToPlainTextConverter from maven-plugin-tools-generators, not needed dependencies can be excluded --- pom.xml | 48 +++++++++++++++++----- .../apache/maven/plugins/help/DescribeMojo.java | 16 ++++---- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index b7e5fb0..1553aa4 100644 --- a/pom.xml +++ b/pom.xml @@ -101,18 +101,43 @@ <version>${mavenVersion}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-settings-builder</artifactId> - <version>${mavenVersion}</version> - <scope>provided</scope> - </dependency> <!-- maven plugin tools --> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-tools-generators</artifactId> <version>${maven.plugin.tools.version}</version> + <exclusions> + <!-- we only need one class HtmlToPlainTextConverter --> + <exclusion> + <groupId>org.apache.maven</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.maven.reporting</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.velocity</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>net.sf.jtidy</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>org.codehaus.plexus</groupId> + <artifactId>*</artifactId> + </exclusion> + <exclusion> + <groupId>org.ow2.asm</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -126,7 +151,14 @@ <groupId>org.apache.maven.shared</groupId> <artifactId>maven-shared-utils</artifactId> <version>3.3.4</version> + <exclusions> + <exclusion> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </exclusion> + </exclusions> </dependency> + <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-api</artifactId> @@ -145,10 +177,6 @@ <artifactId>plexus-interactivity-api</artifactId> <version>1.1</version> <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </exclusion> <exclusion> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-container-default</artifactId> diff --git a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java index dc3cbe3..24fd3a1 100644 --- a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java +++ b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.apache.maven.RepositoryUtils; import org.apache.maven.lifecycle.DefaultLifecycles; @@ -56,8 +57,7 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.reporting.MavenReport; import org.apache.maven.shared.utils.logging.MessageUtils; -import org.apache.maven.tools.plugin.generator.GeneratorUtils; -import org.apache.maven.tools.plugin.util.PluginUtils; +import org.apache.maven.tools.plugin.generator.HtmlToPlainTextConverter; import org.codehaus.plexus.util.StringUtils; import org.eclipse.aether.artifact.Artifact; import org.eclipse.aether.artifact.DefaultArtifact; @@ -420,8 +420,9 @@ public class DescribeMojo extends AbstractHelpMojo { append(buffer, "This plugin has " + mojos.size() + " goal" + (mojos.size() > 1 ? "s" : "") + ":", 0); buffer.append(LS); - mojos = new ArrayList<>(mojos); - PluginUtils.sortMojos(mojos); + mojos = mojos.stream() + .sorted((m1, m2) -> m1.getGoal().compareToIgnoreCase(m2.getGoal())) + .collect(Collectors.toList()); for (MojoDescriptor md : mojos) { describeMojoGuts(md, buffer, detail); @@ -545,8 +546,9 @@ public class DescribeMojo extends AbstractHelpMojo { return; } - params = new ArrayList<>(params); - PluginUtils.sortMojoParameters(params); + params = params.stream() + .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) + .collect(Collectors.toList()); append(buffer, "Available parameters:", 1); @@ -890,7 +892,7 @@ public class DescribeMojo extends AbstractHelpMojo { */ private static String toDescription(String description) { if (StringUtils.isNotEmpty(description)) { - return GeneratorUtils.toText(description); + return new HtmlToPlainTextConverter().convert(description); } return "(no description available)";