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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With