2008/7/11 Atle Prange <[EMAIL PROTECTED]>: > Hi, > > i am currently trying to write a bundle that utilizes some other open > source project. To save me some time i just want to embed the direct > dependencies i have defined in the maven pom (as opposed to making bundles > of the dependencies and import the packages, i am lazy). This works fine, > except that the transitive dependencies are also embedded. I set the > Embed-Dependency to "false", but still no success.. >
it's a problem with your Private-Package (you set it to *, which is the full compilation classpath) see below for a longer explanation, for details of Bnd instructions see http://aqute.biz/Code/Bnd > <plugin> > <groupId>org.apache.felix</groupId> > <artifactId>maven-bundle-plugin</artifactId> > <extensions>true</extensions> > <version>1.4.0</version> > <configuration> > <instructions> > <Export-Package></Export-Package> > <Import-Package>*</Import-Package> this isn't necessary, as the default Import-Package is * > <Embed-Dependency>*;scope=runtime</Embed-Dependency> ok, this will embed runtime dependencies as jars - if you want to inline them, use: <Embed-Dependency>*;scope=runtime;inline=true</Embed-Dependency> > <Embed-Transitive>false</Embed-Transitive> > <Private-Package>*</Private-Package> here you are asking Bnd to add *all* packages from the compilation classpath (excluding provided dependencies) to the final bundle, which is why you see the transitive dependencies, which are also on the classpath, in your final bundle. [ background on Bnd - it takes a classpath and a set of instructions and "pulls" classes and resources into a bundle - that way you can easily slice a project classpath into one or more bundles ] so for your bundle, you'll want to set Private-Package to be the packages from your project source, like "org.foo.*" if you have src/main/java/org/foo/Bar.java... we could consider setting more useful defaults based on the actual sources, currently we base them on the artifactId, because it's more straightforward: <Bundle-SymbolicName> is assumed to be "${groupId}.${artifactId}". <Export-Package> is assumed to be "<Bundle-SymbolicName>.*", unless <Private-Package> is specified, then <Export-Package> is assumed to be empty. <Private-Package> is assumed to be empty by default. <Import-Package> is assumed to be "*", which imports everything referred to by the bundle content, but not contained in the bundle. but feel free to raise a JIRA issue for a better Private-Package default: http://issues.apache.org/jira/browse/FELIX/component/12311143 follow up: there is an overlap between using Export-Package/Private-Package vs. Embed-Dependency to embed packages from dependencies - all of them will allow you to pull in dependency code into the final bundle, but the embed instructions give you more control and support embedding as jars HTH > <Bundle-Activator>no.ap.web.Activator</Bundle-Activator> > </instructions> > </configuration> > </plugin> > > any clarifying hints would be appreciated :) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Cheers, Stuart

