From cb7b10d4b91f03c69012ae4c3d9dbbc6f71d6f8b Mon Sep 17 00:00:00 2001 From: crazyhzm Date: Fri, 5 Jan 2024 10:57:21 +0800 Subject: [PATCH] [MSHADE-462] 3.5.1 not compatible with 3.4.1: The version cannot be empty. Signed-off-by: crazyhzm --- .../java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java index a8475d92..54aaebb5 100644 --- a/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java +++ b/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java @@ -39,6 +39,7 @@ import org.apache.maven.RepositoryUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; +import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Dependency; import org.apache.maven.model.Exclusion; @@ -808,7 +809,9 @@ private File resolveArtifactForClassifier(Artifact artifact, String classifier) org.eclipse.aether.artifact.Artifact coordinate = RepositoryUtils.toArtifact(new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), - artifact.getVersionRange(), + artifact.getVersionRange() == null + ? VersionRange.createFromVersion(artifact.getVersion()) + : artifact.getVersionRange(), artifact.getScope(), artifact.getType(), classifier,