Skip to content

Commit

Permalink
[MPH-201] Use only what we need from maven-plugin-tools-generators
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slawekjaranowski committed Mar 12, 2023
1 parent ff5cfc1 commit 505d612
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 17 deletions.
48 changes: 38 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
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;
Expand All @@ -56,8 +57,7 @@
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;
Expand Down Expand Up @@ -420,8 +420,9 @@ private void describePlugin(PluginDescriptor pd, StringBuilder buffer)
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);
Expand Down Expand Up @@ -545,8 +546,9 @@ private void describeMojoParameters(MojoDescriptor md, StringBuilder buffer)
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);

Expand Down Expand Up @@ -890,7 +892,7 @@ private boolean isReportGoal(MojoDescriptor md) {
*/
private static String toDescription(String description) {
if (StringUtils.isNotEmpty(description)) {
return GeneratorUtils.toText(description);
return new HtmlToPlainTextConverter().convert(description);
}

return "(no description available)";
Expand Down

0 comments on commit 505d612

Please sign in to comment.