My solution isn't exactly automatic and transparent because you need to create a maven pom.xml, but what I do is create a simple pom that lists the original jar as a dependency, uses the dependency-maven-plugin to extract the contents to target/classes, and then uses the maven-bundle-plugin to package as a bundle. I do this for all 3rd party jars that I need to package as bundles and I just keep them in a large project in SVN and then my CI builds rebuild when I make changes and deploy to my internal maven repository. I use bnd from a command line to figure out what the imports are, etc. before creating the pom.
I realize from your question that you probably want something transparent without maintaining a pom, but I think what you are asking for can be done with a little tweaking... I have attached a sample pom.xml from one of my projects. Chris On 2/6/07, Carlos Sanchez <[EMAIL PROTECTED]> wrote:
This may be more a BND question, but here it goes Is there a way to generate a bundle that matches exactly the contents of a jar (besides the manifest of course)? For what I've seen so far you need to pass the whole classpath to BND so it can generate import headers with versions, and EXPORT_PACKAGE to tell it what packages you want. i'm looking for an easy way to to express export everything in this jar and nothing else. IIRC that was the way the osgi maven plugin worked, creating bundles 1 to 1 from jars. tia -- I could give you my word as a Spaniard. No good. I've known too many Spaniards. -- The Princess Bride
<?xml version="1.0"?> <project> <parent> <artifactId>jide.osgi</artifactId> <groupId>com.jidesoft.osgi</groupId> <version>1.8.6.05</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>common</artifactId> <packaging>bundle</packaging> <name>Jide Common (OSGi Bundle)</name> <url>http://www.jidesoft.com</url> <dependencies> <dependency> <groupId>com.jidesoft</groupId> <artifactId>jide-common</artifactId> <version>1.8.6.05</version> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <configuration> <instructions> <Export-Package>com.jidesoft.*</Export-Package> <Import-Package>apple.laf;resolution:=optional, com.sun.java.swing.plaf.windows;resolution:=optional, javax.accessibility, javax.swing, javax.swing.border, javax.swing.event, javax.swing.filechooser, javax.swing.plaf, javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.table, javax.swing.text, javax.swing.tree, javax.xml.parsers, org.w3c.dom, org.xml.sax, sun.java2d, sun.print, sun.security.action </Import-Package> <DynamicImport-Package>com.jidesoft.*</DynamicImport-Package> </instructions> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dependency-maven-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>compile</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.jidesoft</groupId> <artifactId>jide-common</artifactId> <version>1.8.6.05</version> <type>jar</type> </artifactItem> </artifactItems> <outputDirectory> ${project.build.directory}/classes </outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>