Skip to content

Commit

Permalink
[MDEP-831] Remove dependency on commons-lang3 (#270)
Browse files Browse the repository at this point in the history
Remove dependency on Apache Commons Lang
  • Loading branch information
elharo committed Dec 3, 2022
1 parent 68b7272 commit 799ff97
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,6 @@ under the License.
<version>3.3.4</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -53,7 +52,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (ancestors.isEmpty()) {
getLog().info("No Ancestor POMs!");
} else {
getLog().info(String.format(Locale.US, "Ancestor POMs: %s", StringUtils.join(ancestors, " <- ")));
getLog().info("Ancestor POMs: " + String.join(" <- ", ancestors));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.plugin.AbstractMojo;
Expand All @@ -40,6 +39,7 @@
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
import org.apache.maven.shared.utils.StringUtils;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.context.Context;
Expand Down Expand Up @@ -512,7 +512,8 @@ private void writeDependencyXML(Set<Artifact> artifacts) {
writer.endElement();
writer.startElement("version");
writer.writeText(artifact.getBaseVersion());
if (!StringUtils.isBlank(artifact.getClassifier())) {
String classifier = artifact.getClassifier();
if (StringUtils.isNotBlank(classifier)) {
writer.startElement("classifier");
writer.writeText(artifact.getClassifier());
writer.endElement();
Expand Down Expand Up @@ -541,7 +542,6 @@ private void writeScriptableOutput(Set<Artifact> artifacts) {
// called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
artifact.isSnapshot();

// CHECKSTYLE_OFF: LineLength
buf.append(scriptableFlag)
.append(":")
.append(pomFile)
Expand All @@ -554,7 +554,6 @@ private void writeScriptableOutput(Set<Artifact> artifacts) {
.append(":")
.append(artifact.getScope())
.append(System.lineSeparator());
// CHECKSTYLE_ON: LineLength
}
getLog().info(System.lineSeparator() + buf);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.maven.plugins.dependency.resolvers;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -30,13 +29,11 @@
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @since 2.0-alpha2
*/
// CHECKSTYLE_OFF: LineLength
@Mojo(
name = "sources",
defaultPhase = LifecyclePhase.GENERATE_SOURCES,
requiresDependencyResolution = ResolutionScope.TEST,
threadSafe = true)
// CHECKSTYLE_ON: LineLength
public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {

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

Expand Down

0 comments on commit 799ff97

Please sign in to comment.