Hi,
This sounds like a problem of stuff in the root package of one of the
libraries -- JDOM is known for having 3 (IIRC) classes in the root
package posing all sorts of problems because the root package cannot be
imported (and the root package should not be used anyways).
So the only solution, I see here is to prevent this problem is embedded
JDOM as a library as in:
<Embed-Dependencies>
jdom
</Embed-Dependencies>
If you don't want to embed libraries, I suggest you control inlining by
limiting it to the org.jdom package, as in:
<Embed-Dependencies>
jdom;inline=org/jdom/**
</Embed-Dependencies>
Hope this helps.
Regards
Felix
On 13.01.2010 13:44, Renaud Pelissier wrote:
> Hello,
>
> I have spent the last two days trying to understand what I am doing
> wrong but I cannot find out by myself.
>
> I want to build a lib bundle that will contain the package
> "fr.numvision.common" using Maven and the maven-bundle-plugin. So every
> classes inside it can ben used by some other bundle.
> My package depends on external jars such as commons-io, log4j, jdom...
> so they need to be embedded into the bundle.
>
> The bnd part of the plugin looks like:
> <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
> <Bundle-Name>${pom.artifactId}</Bundle-Name>
> <Bundle-Version>2.0</Bundle-Version>
> <Export-Package>fr.numvision.*</Export-Package>
> <Private-Package>!fr.numvision.*,*</Private-Package>
>
> Everythings build fines, I can even install the bundle into felix. The
> pb comes when I try to activate the bunde.
>
> Here is what I get:
>
> -> install file:D:\MavenRepositoryImports\common-1.0-SNAPSHOT.jar
> Bundle ID: 9
> -> ps
> START LEVEL 1
> ID State Level Name
> [ 0] [Active ] [ 0] System Bundle (2.0.1)
> [ 1] [Active ] [ 1] Apache Felix Bundle Repository (1.4.2)
> [ 2] [Active ] [ 1] Apache Felix Shell Service (1.4.1)
> [ 3] [Active ] [ 1] Apache Felix Shell TUI (1.4.1)
> [ 9] [Installed ] [ 1] common (2.0)
> -> start 9
> org.osgi.framework.BundleException: Unresolved constraint in bundle
> fr.numvision.common [9]: package; (package=.)
>
>
> I do not understand this error: every lib class where embedded in the
> jar. The only strange things I can see is the Import-Package part of the
> MANIFEST which starts by "." and by the package name itself (isn'it
> strange for the package to import itself?).
>
> Thanks for your help, I am litteraly getting crazy!
>
> Renaud Pelissier
>
>
>
>
> The MANIFEST.MF
>
> Manifest-Version: 1.0
> Export-Package: fr.numvision.common.xml;uses:="fr.numvision.common",fr
> .numvision.common.windows,fr.numvision.common.ssh;uses:="fr.numvision
> .common.xml,fr.numvision.common",fr.numvision.common,fr.numvision.com
> mon.exec;uses:="fr.numvision.common"
> Private-Package: com.jcraft.jsch,com.jcraft.jsch.jce,com.jcraft.jsch.j
> craft,com.jcraft.jsch.jgss,org.apache.commons.exec,org.apache.commons
> .exec.environment,org.apache.commons.exec.launcher,org.apache.commons
> .exec.util,org.apache.commons.io,org.apache.commons.io.comparator,org
> .apache.commons.io.filefilter,org.apache.commons.io.input,org.apache.
> commons.io.output,org.apache.commons.lang,org.apache.commons.lang.bui
> lder,org.apache.commons.lang.enum,org.apache.commons.lang.enums,org.a
> pache.commons.lang.exception,org.apache.commons.lang.math,org.apache.
> commons.lang.mutable,org.apache.commons.lang.text,org.apache.commons.
> lang.time,org.jdom,org.jdom.adapters,org.jdom.filter,org.jdom.input,o
> rg.jdom.output,org.jdom.transform,org.jdom.xpath,org.snipecode.reg,or
> g.snipecode.reg.test
> Built-By: renaud
> Tool: Bnd-0.0.238
> Bundle-Name: common
> Created-By: Apache Maven Bundle Plugin
> Build-Jdk: 1.6.0_17
> Bundle-Version: 2.0
> Bnd-LastModified: 1263312797074
> Bundle-ManifestVersion: 2
> Import-Package: .,fr.numvision.common,fr.numvision.common.exec,fr.numv
> ision.common.ssh,fr.numvision.common.windows,fr.numvision.common.xml,
> javax.crypto,javax.crypto.interfaces,javax.crypto.spec,javax.xml.pars
> ers,javax.xml.transform,javax.xml.transform.sax,javax.xml.transform.s
> tream,junit.framework,oracle.xml.parser,oracle.xml.parser.v2,org.apac
> he.xerces.dom,org.apache.xerces.parsers,org.ietf.jgss,org.jaxen,org.j
> axen.jdom,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers
> Bundle-SymbolicName: fr.numvision.common
> Originally-Created-By: Apache Maven Bundle Plugin
>
>
>
> The POM:
>
> <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>fr.numvision</groupId>
> <artifactId>common</artifactId>
> <packaging>bundle</packaging>
> <version>1.0-SNAPSHOT</version>
> <name>common</name>
> <url>http://maven.apache.org</url>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <scope>test</scope>
> </dependency>
> <!--
> mvn install:install-file -DgroupId=org.apache.commons
> -DartifactId=exec -Dversion=1.0 -Dpackaging=jar
>
> -Dfile=D:\MavenRepositoryImports\commons-exec-1.0\commons-exec-1.0.jar
> -->
> <dependency>
> <groupId>org.apache.commons</groupId>
> <artifactId>commons-exec</artifactId>
> <version>1.0</version>
> <scope>compile</scope>
> </dependency>
> <!--
> mvn install:install-file -DgroupId=org.apache.commons
> -DartifactId=exec -Dversion=1.0 -Dpackaging=jar
>
> -Dfile=D:\MavenRepositoryImports\commons-exec-1.0\commons-exec-1.0.jar
> -->
> <dependency>
> <groupId>commons-io</groupId>
> <artifactId>commons-io</artifactId>
> <version>1.4</version>
> <scope>compile</scope>
> </dependency>
>
> <!--
> mvn install:install-file -DgroupId=org.apache.commons
> -DartifactId=lang -Dversion=2.4 -Dpackaging=jar
>
> -Dfile=D:\MavenRepositoryImports\commons-lang-2.4\commons-lang-2.4.jar
> -->
> <dependency>
> <groupId>commons-lang</groupId>
> <artifactId>commons-lang</artifactId>
> <version>2.4</version>
> <scope>compile</scope>
> </dependency>
>
> <!-- D:\MavenRepositoryImports\jsch-0.1.42 -->
> <dependency>
> <groupId>com.jcraft</groupId>
> <artifactId>jsch</artifactId>
> <version>0.1.41</version>
> <scope>compile</scope>
> </dependency>
>
> <!--
> mvn install:install-file -DgroupId=org.snipecode
> -DartifactId=reg
> -Dversion=1.0 -Dpackaging=jar
> -Dfile=D:\MavenRepositoryImports\org.snipecode.reg-1.0.jar
> -->
> <dependency>
> <groupId>org.snipecode</groupId>
> <artifactId>reg</artifactId>
> <version>1.0</version>
> <scope>compile</scope>
> </dependency>
> <dependency>
> <groupId>org.jdom</groupId>
> <artifactId>jdom</artifactId>
> <version>1.1</version>
> <scope>compile</scope>
> </dependency>
>
> </dependencies>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>1.4.0</version>
> <extensions>true</extensions>
> <configuration>
>
> <excludeDependencies>*;scope=provided|runtime</excludeDependencies>
> <instructions>
>
> <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
> <Bundle-Name>${pom.artifactId}</Bundle-Name>
> <Bundle-Version>2.0</Bundle-Version><!--Tout ce
> qui est dans Private-Package sera copié à l'intérieur du paquet
> org.apache.*,com.jcraft.*,org.jdom.*,org.snipecode.*-->
> <Export-Package>fr.numvision.*</Export-Package>
> <Private-Package>!fr.numvision.*,*</Private-Package>
> </instructions>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]