On 12/11/2007, Martijn Hendriks <[EMAIL PROTECTED]> wrote: > > Hi, > > We're moving from the old maven-osgi-plugin to the maven-bundle-plugin. > We used to have a osgi-bundle subproject that embedded a library and > another jar subproject that had a compile-scope dependency on the > bundle. This worked fine. Now we're using the maven-bundle-plugin (with > the directive > <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency>) to > build the first subproject. The bundle contents look ok...all classes > are there.
by this I assume you mean the embedded jarfile is there - if inline is set to false the jarfile will be embedded as single jar instead of inlined as a set of classes and will also be added to the Bundle-ClassPath. note that you should _not_ set Export-Package to * as this will also include all the compile scope classes inside the bundle, which is not necessary with embedding - if you want to export the complete contents without pulling in all compile scope classes then use <_exportcontents>*</_exportcontents> also remember that any classes in an embedded jar inside a bundle, while visible to OSGi, will not be visible during standard 'javac' compilation or in standard Java applications run outside of an OSGi container (as the default classloader doesn't know about the embedded jar) Unfortunately, the unit tests now fail due to a > NoClassDefFoundError: the classes in the embedded library in the bundle > cannot be found during the unit tests. When the inline option is set to > "true", then it works again. if your unit tests are run outside of an OSGi container then I would expect this, as the test framework would not see the embedded jar on the basic classpath Is there a way to not inline the compile > scope dependencies in the bundle and make this work? Thanks! you kind of answered this yourself in the sentence above - if you want embedded classes available when you use the bundle outside of OSGi (ie. as a plain library) then they must be inlined, ie: <Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency> BTW, the reason your setup worked with the old maven-osgi-plugin was because it assembled the bundle contents in the output folder (ie. target/classes) before finally jar'ing everything up - and in Maven, any dependent projects in the same reactor use the 'target/classes' directory instead of the artifact file so the unpacked bundle contents were available to your unit tests - however if you cleaned the bundle project then went to the unit test project and re-ran it, it would fail, as it would use the final bundle file with the bundle-plugin, because the Bnd tool assembles the bundle in memory, there's no unpacked content under 'target/classes' to match the classpath that Maven passes to the unit tests - however you can get this by using the maven dependency plugin to unpack the bundle (ie. either unpack it to 'target/classes' in the bundle project or the unit test project) HTH Best regards, > > Martijn > > -- > > Martijn Hendriks > <GX> creative online development B.V. > > t: 024 - 3888 261 > f: 024 - 3888 621 > e: [EMAIL PROTECTED] > > Wijchenseweg 111 > 6538 SW Nijmegen > http://www.gx.nl/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Cheers, Stuart

