Skip to content

Commit 5633b56

Browse files
committed
Add testcase for a signed artifact and remove entries from manifest
1 parent 82f9917 commit 5633b56

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

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

+22
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,28 @@ public void testSourceWithSignature() throws Exception {
104104
assertTrue("No source bundle generated!", sourcesFound);
105105
}
106106

107+
@Test
108+
public void testArtifactWithSignature() throws Exception {
109+
ITargetLocation target = resolveMavenTarget(
110+
"""
111+
<location includeDependencyDepth="none" includeDependencyScopes="compile" label="verapdf" includeSource="true" missingManifest="generate" type="Maven">
112+
<dependencies>
113+
<dependency>
114+
<groupId>org.verapdf</groupId>
115+
<artifactId>core</artifactId>
116+
<version>1.26.5</version>
117+
</dependency>
118+
</dependencies>
119+
</location>
120+
""");
121+
assertStatusOk(getTargetStatus(target));
122+
TargetBundle[] allBundles = target.getBundles();
123+
for (TargetBundle targetBundle : allBundles) {
124+
assertValidSignature(targetBundle);
125+
}
126+
assertTrue("No bundle generated!", allBundles.length > 0);
127+
}
128+
107129
@Test
108130
public void testBadDependencyDirect() throws Exception {
109131
ITargetLocation target = resolveMavenTarget("""

org.eclipse.m2e.pde.target/src/org/eclipse/m2e/pde/target/shared/MavenBundleWrapper.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,12 @@ private static WrappedBundle getWrappedNode(DependencyNode node,
226226
analyzer.addClasspath(depJar);
227227
analyzer.removeClose(depJar);
228228
}
229-
analyzerJar.setManifest(analyzer.calcManifest());
229+
Manifest manifest = analyzer.calcManifest();
230+
Map<String, Attributes> entries = manifest.getEntries();
231+
if (entries != null) {
232+
entries.clear();
233+
}
234+
analyzerJar.setManifest(manifest);
230235
analyzerJar.write(wrapArtifactFile);
231236
for (String err : analyzer.getErrors()) {
232237
if (err.contains("Classes found in the wrong directory")) {

0 commit comments

Comments
 (0)