From c200ceaaef1a724592900b38636b51c11cb94512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Wed, 21 Feb 2024 15:42:28 +0100 Subject: [PATCH] Add testcase for classifier with transitive dependencies Currently if a dependency is specified the transitive items seem to be not correctly collected, at laest there is one artifact (ehcache) that has a transitive dependency that is invalid (javax.xml) and one can select a different classifier (jakarta) to use the jakarta ones but this seem not to happen at the moment. This adds a testcase to illustrate the problem. --- .../tests/OSGiMetadataGenerationTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests/OSGiMetadataGenerationTest.java b/org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests/OSGiMetadataGenerationTest.java index dee76b5ee8..2fa4fa9838 100644 --- a/org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests/OSGiMetadataGenerationTest.java +++ b/org.eclipse.m2e.pde.target.tests/src/org/eclipse/m2e/pde/target/tests/OSGiMetadataGenerationTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import java.net.URI; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -55,6 +56,34 @@ public void testBadDependencyInChain() throws Exception { assertStatusOk(getTargetStatus(target)); } + @Test + public void testWithClassifierFailsToCollect() throws Exception { + String targetXML = """ + + + + org.ehcache + ehcache + 3.10.0 + jar + jakarta + + + + """; + for (String deepth : new String[] { "none", "direct", "infinite" }) { + 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(location.toString(), + location.toString().endsWith("org/ehcache/ehcache/3.10.0/ehcache-3.10.0-jakarta.jar")); + } + } + } + @Test public void testBadDependencyDirect() throws Exception { ITargetLocation target = resolveMavenTarget("""