Details
Description
As BundleRef and its parent ArtifactRef are defining the same variable artifact and the artifact resolver is resolving artifacts via ArtifactRef accessing the artifact via BundleRef returns null.
This bug is leading to an error using the following goal and configuration
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
...
<goals>
<goal>features-export-meta-data</goal>
</goals>
<configuration>
...
<mergedFeature>true</mergedFeature>
<oneVersion>true</oneVersion>
</configuration>
</execution>
</executions>
</plugin>
as maps for merging are being filled with null values instead of unique artifact attributes.
The root reason is unfortunately supressed see
BundleRef.java
public void readManifest() { JarInputStream bundleJar = null; try { File file = artifact.getFile(); bundleJar = new JarInputStream(new FileInputStream(file)); Manifest manifest = bundleJar.getManifest(); bundleSymbolicName = manifest.getMainAttributes().getValue("Bundle-SymbolicName"); bundleVersion = manifest.getMainAttributes().getValue("Bundle-Version"); bundleJar.close(); } catch (Exception e) { // Ignore errors in manifest } }
I attached a patch correcting the polymorphism but it seems to be a good idea to think about better error handling at this part.