Skip to content

Commit 505d612

Browse files
[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
1 parent ff5cfc1 commit 505d612

File tree

2 files changed

+47
-17
lines changed

2 files changed

+47
-17
lines changed

pom.xml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,43 @@
101101
<version>${mavenVersion}</version>
102102
<scope>provided</scope>
103103
</dependency>
104-
<dependency>
105-
<groupId>org.apache.maven</groupId>
106-
<artifactId>maven-settings-builder</artifactId>
107-
<version>${mavenVersion}</version>
108-
<scope>provided</scope>
109-
</dependency>
110104

111105
<!-- maven plugin tools -->
112106
<dependency>
113107
<groupId>org.apache.maven.plugin-tools</groupId>
114108
<artifactId>maven-plugin-tools-generators</artifactId>
115109
<version>${maven.plugin.tools.version}</version>
110+
<exclusions>
111+
<!-- we only need one class HtmlToPlainTextConverter -->
112+
<exclusion>
113+
<groupId>org.apache.maven</groupId>
114+
<artifactId>*</artifactId>
115+
</exclusion>
116+
<exclusion>
117+
<groupId>org.apache.maven.plugin-tools</groupId>
118+
<artifactId>*</artifactId>
119+
</exclusion>
120+
<exclusion>
121+
<groupId>org.apache.maven.reporting</groupId>
122+
<artifactId>*</artifactId>
123+
</exclusion>
124+
<exclusion>
125+
<groupId>org.apache.velocity</groupId>
126+
<artifactId>*</artifactId>
127+
</exclusion>
128+
<exclusion>
129+
<groupId>net.sf.jtidy</groupId>
130+
<artifactId>*</artifactId>
131+
</exclusion>
132+
<exclusion>
133+
<groupId>org.codehaus.plexus</groupId>
134+
<artifactId>*</artifactId>
135+
</exclusion>
136+
<exclusion>
137+
<groupId>org.ow2.asm</groupId>
138+
<artifactId>*</artifactId>
139+
</exclusion>
140+
</exclusions>
116141
</dependency>
117142

118143
<dependency>
@@ -126,7 +151,14 @@
126151
<groupId>org.apache.maven.shared</groupId>
127152
<artifactId>maven-shared-utils</artifactId>
128153
<version>3.3.4</version>
154+
<exclusions>
155+
<exclusion>
156+
<groupId>commons-io</groupId>
157+
<artifactId>commons-io</artifactId>
158+
</exclusion>
159+
</exclusions>
129160
</dependency>
161+
130162
<dependency>
131163
<groupId>org.apache.maven.reporting</groupId>
132164
<artifactId>maven-reporting-api</artifactId>
@@ -145,10 +177,6 @@
145177
<artifactId>plexus-interactivity-api</artifactId>
146178
<version>1.1</version>
147179
<exclusions>
148-
<exclusion>
149-
<groupId>org.codehaus.plexus</groupId>
150-
<artifactId>plexus-utils</artifactId>
151-
</exclusion>
152180
<exclusion>
153181
<groupId>org.codehaus.plexus</groupId>
154182
<artifactId>plexus-container-default</artifactId>

src/main/java/org/apache/maven/plugins/help/DescribeMojo.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.StringTokenizer;
3131
import java.util.regex.Matcher;
3232
import java.util.regex.Pattern;
33+
import java.util.stream.Collectors;
3334

3435
import org.apache.maven.RepositoryUtils;
3536
import org.apache.maven.lifecycle.DefaultLifecycles;
@@ -56,8 +57,7 @@
5657
import org.apache.maven.project.ProjectBuildingRequest;
5758
import org.apache.maven.reporting.MavenReport;
5859
import org.apache.maven.shared.utils.logging.MessageUtils;
59-
import org.apache.maven.tools.plugin.generator.GeneratorUtils;
60-
import org.apache.maven.tools.plugin.util.PluginUtils;
60+
import org.apache.maven.tools.plugin.generator.HtmlToPlainTextConverter;
6161
import org.codehaus.plexus.util.StringUtils;
6262
import org.eclipse.aether.artifact.Artifact;
6363
import org.eclipse.aether.artifact.DefaultArtifact;
@@ -420,8 +420,9 @@ private void describePlugin(PluginDescriptor pd, StringBuilder buffer)
420420
append(buffer, "This plugin has " + mojos.size() + " goal" + (mojos.size() > 1 ? "s" : "") + ":", 0);
421421
buffer.append(LS);
422422

423-
mojos = new ArrayList<>(mojos);
424-
PluginUtils.sortMojos(mojos);
423+
mojos = mojos.stream()
424+
.sorted((m1, m2) -> m1.getGoal().compareToIgnoreCase(m2.getGoal()))
425+
.collect(Collectors.toList());
425426

426427
for (MojoDescriptor md : mojos) {
427428
describeMojoGuts(md, buffer, detail);
@@ -545,8 +546,9 @@ private void describeMojoParameters(MojoDescriptor md, StringBuilder buffer)
545546
return;
546547
}
547548

548-
params = new ArrayList<>(params);
549-
PluginUtils.sortMojoParameters(params);
549+
params = params.stream()
550+
.sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName()))
551+
.collect(Collectors.toList());
550552

551553
append(buffer, "Available parameters:", 1);
552554

@@ -890,7 +892,7 @@ private boolean isReportGoal(MojoDescriptor md) {
890892
*/
891893
private static String toDescription(String description) {
892894
if (StringUtils.isNotEmpty(description)) {
893-
return GeneratorUtils.toText(description);
895+
return new HtmlToPlainTextConverter().convert(description);
894896
}
895897

896898
return "(no description available)";

0 commit comments

Comments
 (0)