You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2024/11/28 13:40:07 UTC
(maven-dependency-plugin) branch master updated: [MDEP-952] Decouple DependencyUtil from StringUtils (#491)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 00790304 [MDEP-952] Decouple DependencyUtil from StringUtils (#491)
00790304 is described below
commit 00790304ce8ad42c88f2d5b730d14ddc959bc553
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Thu Nov 28 13:40:02 2024 +0000
[MDEP-952] Decouple DependencyUtil from StringUtils (#491)
* Decouple DependencyUtil from StringUtils
---
.../plugins/dependency/utils/DependencyUtil.java | 17 ++++-------------
.../plugins/dependency/utils/TestDependencyUtil.java | 20 --------------------
2 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
index 6dad61eb..5ec05ccd 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java
@@ -29,7 +29,6 @@ import java.nio.file.OpenOption;
import java.nio.file.StandardOpenOption;
import java.util.Objects;
-import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.plugin.logging.Log;
@@ -119,7 +118,9 @@ public final class DependencyUtil {
String classifierString = "";
- if (!removeClassifier && StringUtils.isNotEmpty(artifact.getClassifier())) {
+ if (!removeClassifier
+ && artifact.getClassifier() != null
+ && !artifact.getClassifier().isEmpty()) {
classifierString = "-" + artifact.getClassifier();
}
destFileName.append(artifact.getArtifactId()).append(versionString);
@@ -186,7 +187,7 @@ public final class DependencyUtil {
sb.append(artifact.getVersion());
}
- if (StringUtils.isNotEmpty(artifact.getClassifier())) {
+ if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
sb.append("-");
sb.append(artifact.getClassifier());
}
@@ -259,16 +260,6 @@ public final class DependencyUtil {
}
}
- /**
- * Mainly used to parse excludes, includes configuration.
- *
- * @param str the string to split
- * @return the result items
- */
- public static String[] tokenizer(String str) {
- return StringUtils.split(cleanToBeTokenizedString(str), ",");
- }
-
/**
* Clean up configuration string before it can be tokenized.
*
diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
index ceaa05a7..8de8ce0d 100644
--- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
+++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java
@@ -320,26 +320,6 @@ class TestDependencyUtil {
assertEquals(expectedResult, name);
}
- @Test
- void testTokenizer() {
- String[] tokens = DependencyUtil.tokenizer(" alpha,bravo, charlie , delta kappa, theta");
- String[] expected = new String[] {"alpha", "bravo", "charlie", "delta kappa", "theta"};
- // easier to see in the JUnit reports
- assertEquals(String.join(", ", expected), String.join(", ", tokens));
- assertEquals(expected.length, tokens.length);
-
- tokens = DependencyUtil.tokenizer(" \r\n a, \t \n \r b \t \n \r");
- assertEquals(2, tokens.length);
- assertEquals("a", tokens[0]);
- assertEquals("b", tokens[1]);
-
- tokens = DependencyUtil.tokenizer(null);
- assertEquals(0, tokens.length);
-
- tokens = DependencyUtil.tokenizer(" ");
- assertEquals(0, tokens.length);
- }
-
@Test
void outputFileShouldBeOverridden() throws IOException {
File file = new File(temDir, "file1.out");