Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
maven-bundle-plugin-1.4.3
-
None
-
any
Description
The conversion of JAR into bundle fails if there are classes is the default name space, like hsqldb does.
Try this pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>bug.maven.plugin</groupId>
<artifactId>felix-bundle</artifactId>
<packaging>bundle</packaging>
<version>1.0-SNAPSHOT</version>
<name>hsqldb</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-ClassPath>target/dependency/hsqldb-1.8.0.7.jar</Bundle-ClassPath>
<Import-Package>*</Import-Package>
<Export-Package>*</Export-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Directory>target/dependency</Embed-Directory>
<Embed-StripGroup>true</Embed-StripGroup>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
To fix this I suggest a modification inside biz.aQute.bndlib.bndlib-0.0.255.jar inside class aQute.lib.osgiProcessor:
private void analyzeJar(Jar jar, String prefix, Map classSpace,
Map contained, Map referred, Map uses) throws IOException {
next: for (Iterator r = jar.getResources().keySet().iterator(); r
.hasNext() {
String path = (String) r.next();
if (path.startsWith(prefix)) {
String relativePath = path.substring(prefix.length());
String pack = getPackage(relativePath);
if (pack != null && !contained.containsKey(pack)) {
if (!(pack.equals(".") || isMetaData(relativePath))) {
The last line is the line where the default name space "." is expicit excluded. I don't understand why, but for class files it must be enabled. I suggest
if (pack != null && !contained.containsKey(pack)) {
if (!(pack.equals(".") || realtivePath.endsWith(".class") || isMetaData(relativePath))) {
to solve this issue.