Skip to content

Commit 5536961

Browse files
committed
Do not collect dependencies for classified artifacts
Signed-off-by: Christoph Läubrich <[email protected]>
1 parent a2218e9 commit 5536961

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests/OSGiMetadataGenerationTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public void testWithClassifierFailsToCollect() throws Exception {
9191
ITargetLocation target = resolveMavenTarget(targetXML.replace("%depth%", deepth));
9292
assertStatusOk(getTargetStatus(target));
9393
TargetBundle[] bundles = target.getBundles();
94-
// TODO check bundle and possible transtive dependencies!
9594
for (TargetBundle targetBundle : bundles) {
9695
URI location = targetBundle.getBundleInfo().getLocation();
9796
assertTrue(

org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/MavenTargetLocation.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,13 @@ private Artifact resolveDependency(MavenTargetDependency root, IMaven maven, Lis
241241
}
242242
if (artifact != null) {
243243
DependencyDepth depth = dependencyDepth;
244+
if (isClassified(artifact)) {
245+
// a classified artifact can not have any dependencies and will actually include
246+
// the ones from the main artifact.
247+
// if the user really wants this it is possible to include the pom typed
248+
// artifact or the main artifact in the list
249+
depth = DependencyDepth.NONE;
250+
}
244251
if (isPomType(artifact) && depth == DependencyDepth.NONE) {
245252
// fetching only the pom but no dependencies does not makes much sense...
246253
depth = DependencyDepth.DIRECT;
@@ -273,6 +280,11 @@ private Artifact resolveDependency(MavenTargetDependency root, IMaven maven, Lis
273280
return artifact;
274281
}
275282

283+
private boolean isClassified(Artifact artifact) {
284+
String classifier = artifact.getClassifier();
285+
return classifier != null && !classifier.isEmpty();
286+
}
287+
276288
private boolean isPomType(Artifact artifact) {
277289
return POM_PACKAGE_TYPE.equals(artifact.getExtension());
278290
}

0 commit comments

Comments
 (0)