Skip to content

Commit

Permalink
Do not collect dependencies for classified artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Läubrich <[email protected]>
  • Loading branch information
laeubi committed Feb 21, 2025
1 parent f059a80 commit dd27f12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public void testWithClassifierFailsToCollect() throws Exception {
ITargetLocation target = resolveMavenTarget(targetXML.replace("%depth%", deepth));
assertStatusOk(getTargetStatus(target));
TargetBundle[] bundles = target.getBundles();
// TODO check bundle and possible transtive dependencies!
for (TargetBundle targetBundle : bundles) {
URI location = targetBundle.getBundleInfo().getLocation();
assertTrue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ private Artifact resolveDependency(MavenTargetDependency root, IMaven maven, Lis
}
if (artifact != null) {
DependencyDepth depth = dependencyDepth;
if (isClassified(artifact)) {
// a classified artifact can not have any dependencies and will actually include
// the ones from the main artifact.
// if the user really wants this it is possible to include the pom typed
// artifact or the main artifact in the list
depth = DependencyDepth.NONE;
}
if (isPomType(artifact) && depth == DependencyDepth.NONE) {
// fetching only the pom but no dependencies does not makes much sense...
depth = DependencyDepth.DIRECT;
Expand Down Expand Up @@ -273,6 +280,11 @@ private Artifact resolveDependency(MavenTargetDependency root, IMaven maven, Lis
return artifact;
}

private boolean isClassified(Artifact artifact) {
String classifier = artifact.getClassifier();
return classifier != null && !classifier.isEmpty();
}

private boolean isPomType(Artifact artifact) {
return POM_PACKAGE_TYPE.equals(artifact.getExtension());
}
Expand Down

0 comments on commit dd27f12

Please sign in to comment.