Skip to content

Commit a2218e9

Browse files
committed
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.
1 parent 135305c commit a2218e9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.junit.Assert.assertNull;
2020
import static org.junit.Assert.assertTrue;
2121

22+
import java.net.URI;
2223
import java.util.Arrays;
2324
import java.util.List;
2425
import java.util.Optional;
@@ -71,6 +72,36 @@ public void testBadSymbolicName() throws Exception {
7172
assertStatusOk(getTargetStatus(target));
7273
}
7374

75+
@Test
76+
public void testWithClassifierFailsToCollect() throws Exception {
77+
String targetXML = """
78+
<location includeDependencyDepth="%depth%" includeDependencyScopes="compile,provided,runtime,system" includeSource="false" missingManifest="generate" type="Maven">
79+
<dependencies>
80+
<dependency>
81+
<groupId>org.ehcache</groupId>
82+
<artifactId>ehcache</artifactId>
83+
<version>3.10.0</version>
84+
<type>jar</type>
85+
<classifier>jakarta</classifier>
86+
</dependency>
87+
</dependencies>
88+
</location>
89+
""";
90+
for (String deepth : new String[] { "none", "direct", "infinite" }) {
91+
ITargetLocation target = resolveMavenTarget(targetXML.replace("%depth%", deepth));
92+
assertStatusOk(getTargetStatus(target));
93+
TargetBundle[] bundles = target.getBundles();
94+
// TODO check bundle and possible transtive dependencies!
95+
for (TargetBundle targetBundle : bundles) {
96+
URI location = targetBundle.getBundleInfo().getLocation();
97+
assertTrue(
98+
"bundle with classifier was not correctly fetched width deepth = " + deepth + " location = "
99+
+ location,
100+
location.toString().endsWith("org/ehcache/ehcache/3.10.0/ehcache-3.10.0-jakarta.jar"));
101+
}
102+
}
103+
}
104+
74105
@Test
75106
public void testSourceWithSignature() throws Exception {
76107
ITargetLocation target = resolveMavenTarget(

0 commit comments

Comments
 (0)