Reputation: 6624
When creating Java OSGi projects in eclipse, you run them by .bndrun-> Run OSGi (for example)
This does not seem to be really workable when you want to distribute your application to a client, since it would be an inconvenience for them to go about having to manually run the bundles in an OSGi container.
Is there a way I could have a "main" jar\ bundle with a public static void main(String[] args) {}
class that automatically starts an OSGi container and loads the bundles, as if it was all in one jar file, when a user runs this file?
Upvotes: 3
Views: 262
Reputation: 15372
See the OSGi enRoute site. The Quick Start tutorial and the Base tutorial explain how to export to an executable JAR. If you use Maven, see the Eval example.
Upvotes: 2
Reputation: 19606
You can simply use the export button in bndtools. It creates a runnable jar that you can distribute.
Bndtools also supports an automated build using gradle.
Recently bndtools also has maven support see this example.
Upvotes: 1