Skip to content

Commit 799ff97

Browse files
authored
[MDEP-831] Remove dependency on commons-lang3 (#270)
Remove dependency on Apache Commons Lang
1 parent 68b7272 commit 799ff97

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

pom.xml

-6
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,6 @@ under the License.
215215
<version>3.3.4</version>
216216
</dependency>
217217

218-
<dependency>
219-
<groupId>org.apache.commons</groupId>
220-
<artifactId>commons-lang3</artifactId>
221-
<version>3.12.0</version>
222-
</dependency>
223-
224218
<dependency>
225219
<groupId>org.apache.commons</groupId>
226220
<artifactId>commons-collections4</artifactId>

src/main/java/org/apache/maven/plugins/dependency/DisplayAncestorsMojo.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.ArrayList;
2222
import java.util.List;
2323
import java.util.Locale;
24-
import org.apache.commons.lang3.StringUtils;
2524
import org.apache.maven.plugin.AbstractMojo;
2625
import org.apache.maven.plugin.MojoExecutionException;
2726
import org.apache.maven.plugin.MojoFailureException;
@@ -53,7 +52,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
5352
if (ancestors.isEmpty()) {
5453
getLog().info("No Ancestor POMs!");
5554
} else {
56-
getLog().info(String.format(Locale.US, "Ancestor POMs: %s", StringUtils.join(ancestors, " <- ")));
55+
getLog().info("Ancestor POMs: " + String.join(" <- ", ancestors));
5756
}
5857
}
5958

src/main/java/org/apache/maven/plugins/dependency/analyze/AbstractAnalyzeMojo.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.List;
2929
import java.util.Map;
3030
import java.util.Set;
31-
import org.apache.commons.lang3.StringUtils;
3231
import org.apache.maven.artifact.Artifact;
3332
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
3433
import org.apache.maven.plugin.AbstractMojo;
@@ -40,6 +39,7 @@
4039
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
4140
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
4241
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
42+
import org.apache.maven.shared.utils.StringUtils;
4343
import org.codehaus.plexus.PlexusConstants;
4444
import org.codehaus.plexus.PlexusContainer;
4545
import org.codehaus.plexus.context.Context;
@@ -512,7 +512,8 @@ private void writeDependencyXML(Set<Artifact> artifacts) {
512512
writer.endElement();
513513
writer.startElement("version");
514514
writer.writeText(artifact.getBaseVersion());
515-
if (!StringUtils.isBlank(artifact.getClassifier())) {
515+
String classifier = artifact.getClassifier();
516+
if (StringUtils.isNotBlank(classifier)) {
516517
writer.startElement("classifier");
517518
writer.writeText(artifact.getClassifier());
518519
writer.endElement();
@@ -541,7 +542,6 @@ private void writeScriptableOutput(Set<Artifact> artifacts) {
541542
// called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
542543
artifact.isSnapshot();
543544

544-
// CHECKSTYLE_OFF: LineLength
545545
buf.append(scriptableFlag)
546546
.append(":")
547547
.append(pomFile)
@@ -554,7 +554,6 @@ private void writeScriptableOutput(Set<Artifact> artifacts) {
554554
.append(":")
555555
.append(artifact.getScope())
556556
.append(System.lineSeparator());
557-
// CHECKSTYLE_ON: LineLength
558557
}
559558
getLog().info(System.lineSeparator() + buf);
560559
}

src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package org.apache.maven.plugins.dependency.resolvers;
2020

21-
import org.apache.commons.lang3.StringUtils;
2221
import org.apache.maven.plugin.MojoExecutionException;
2322
import org.apache.maven.plugins.annotations.LifecyclePhase;
2423
import org.apache.maven.plugins.annotations.Mojo;
@@ -30,13 +29,11 @@
3029
* @author <a href="mailto:[email protected]">Brian Fox</a>
3130
* @since 2.0-alpha2
3231
*/
33-
// CHECKSTYLE_OFF: LineLength
3432
@Mojo(
3533
name = "sources",
3634
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
3735
requiresDependencyResolution = ResolutionScope.TEST,
3836
threadSafe = true)
39-
// CHECKSTYLE_ON: LineLength
4037
public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {
4138

4239
private static final String SOURCE_CLASSIFIER = "sources";
@@ -48,7 +45,7 @@ public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {
4845
*/
4946
@Override
5047
protected void doExecute() throws MojoExecutionException {
51-
if (StringUtils.isEmpty(this.classifier)) {
48+
if (this.classifier == null || this.classifier.isEmpty()) {
5249
this.classifier = SOURCE_CLASSIFIER;
5350
}
5451

0 commit comments

Comments
 (0)