Question

I have a third-party JAR that I'd like to use in an OSGi environment, but it has no OSGi-appropriate MANIFEST.MF. So, I'm using BND (well, BNDTools) to wrap it. That's working fine as well as it goes, but:

I'd also like to be able to easily use it with Maven (which it's also not set up for), so I'd like to include a Maven POM that describes its dependencies. Is there a way to do this through BND? Here's what I've tried:

I looked at the layout of various Mavenized JARs, and found that they seem to include the POM in META-INF/maven/groupId/artifactId. For example:

META-INF/maven/com.example/com.example.greatapilibrary/pom.xml.

So, I made a POM and put it in such a place, then modified bnd.bnd to have:

-include: META-INF/maven/com.example/com.example.greatapilibrary/pom.xml

The generated JAR does not include the file, though.

I think (but not 100% sure) that I'm probably misreading BND's documentation on "-include" - it looks like it might be for including extra manifest directives in the resulting MANIFEST.MF, rather than including extra files in the JAR.

But in any case, is there any way to accomplish what I want to do, using BND? Or do I have to use another rewrapper program to create a JAR with the POM, then use BND to rewrap that instead of using it to rewrap the original JAR?

Thanks in advance for any help.

Was it helpful?

Solution

just try to add:

-includeresource: META-INF/maven/com.example/com.example.greatapilibrary/pom.xml=META-INF/maven/com.example/com.example.greatapilibrary/pom.xml 

to your bnd.bnd

This link explains the differences between includeand includeresource (same as Include-Resource): http://bndtools.org/faq.html#whats-the-difference-between--include-and-include-resource

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top