felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Franke (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-807) conversion of JAR into bundle fails if there are classes is the default name space
Date Fri, 07 Nov 2008 06:16:44 GMT

    [ https://issues.apache.org/jira/browse/FELIX-807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645696#action_12645696
] 

Stefan Franke commented on FELIX-807:
-------------------------------------

Thanks for your input Stuart.

I agree on the default namespace, but there are JARs haveing classes in the default name space
like hsqldb and I would like to have one pom.xml to convert all into a bundle. And I even
dont want to export the default name space!

The   <_failok>true</_failok> suppresses the abortion and thus it works now. And
_failok is not mentioned in   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html#ApacheFelixMavenBundlePlugin(BND)-EmbedDependencyandExportPackage

so I will use now either

            <Import-Package>!*</Import-Package>
            <Export-Package>org.hsqldb.*</Export-Package>
            <Embed-Dependency>hsqldb*;scope=compile|runtime;inline=true</Embed-Dependency>
            <Embed-Directory>target/dependency</Embed-Directory>
            <Embed-StripGroup>true</Embed-StripGroup>
            <_failok>true</_failok>

or

            <Import-Package>!*</Import-Package>
            <_exportcontents>org.hsqldb.*</_exportcontents>
            <Embed-Dependency>hsqldb*;scope=compile|runtime;inline=false</Embed-Dependency>
            <Embed-Directory>target/dependency</Embed-Directory>
            <Embed-StripGroup>true</Embed-StripGroup>
            <_failok>true</_failok>

and the tags starting with an underscore still look wrong.

IMHO there should be no need for <_exportcontents>: The hint "inline=false" is enough
information to avoid unpacking the JAR(s)
Also <_failok> is ugly. It should run smooth without.

> conversion of JAR into bundle fails if there are classes is the default name space
> ----------------------------------------------------------------------------------
>
>                 Key: FELIX-807
>                 URL: https://issues.apache.org/jira/browse/FELIX-807
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven Bundle Plugin
>    Affects Versions: maven-bundle-plugin-1.4.3
>         Environment: any
>            Reporter: Stefan Franke
>            Priority: Minor
>             Fix For: maven-bundle-plugin-1.6.0
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message