Skip to content

Commit

Permalink
revert split
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 20, 2024
1 parent 5590aaa commit c16df4f
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
Expand Down Expand Up @@ -180,6 +181,10 @@ protected List<ArtifactItem> getProcessedArtifactItems(ProcessArtifactItemsReque
} catch (ArtifactFilterException e) {
throw new MojoExecutionException(e.getMessage(), e);
}

if (artifactItem.getType() == null) {
throw new NullPointerException("Missing type for " + artifactItem.getArtifactId());
}
}
return artifactItems;
}
Expand Down Expand Up @@ -215,7 +220,12 @@ protected Artifact getArtifact(ArtifactItem artifactItem) throws MojoExecutionEx
coordinate.setVersion(artifactItem.getVersion());
coordinate.setClassifier(artifactItem.getClassifier());

String type = artifactItem.getType();
if (type == null) {
throw new NullPointerException("missing type");
}
final String extension;

ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler(artifactItem.getType());
if (artifactHandler != null) {
extension = artifactHandler.getExtension();
Expand Down Expand Up @@ -367,7 +377,7 @@ public void setArtifact(String artifact) throws MojoFailureException {
if (artifact != null) {
String packaging = "jar";
String classifier;
String[] tokens = artifact.split(":");
String[] tokens = StringUtils.split(artifact, ":");
if (tokens.length < 3 || tokens.length > 5) {
throw new MojoFailureException("Invalid artifact, "
+ "you must specify groupId:artifactId:version[:packaging[:classifier]] " + artifact);
Expand Down

0 comments on commit c16df4f

Please sign in to comment.