Reputation: 5419
I have a simple question. I followed this tutorial and created a HelloWorld osgi bundle. How can i install and start this bundle using apache Karaf? How can i refer to the bundle using the osgi:install command?
thank you.
Upvotes: 7
Views: 21771
Reputation: 103
Frank's answer helped me quite fast:
I created a bundle with this archetype:
mvn archetype:generate \
-DarchetypeGroupId=org.apache.karaf.archetypes \
-DarchetypeArtifactId=karaf-bundle-archetype \
-DarchetypeVersion=2.2.8 \
-DgroupId=com.mycompany \
-DartifactId=com.mycompany.bundle \
-Dversion=1.0-SNAPSHOT \
-Dpackage=com.mycompany.bundle
Then i did a mvn eclipse:eclipse
and mvn install
.
After copying the generated jar into the deploy directory of my running JBoss Fuse server it printed "Starting the bundle". :-)
Upvotes: 2
Reputation: 2748
Ok, that is another question, but here goes:
You're pretty much on the right track, I've tested the one in the Karaf developers guide you linked to (the second mvn call). The documentation isn't quite correct, I needed to change two things:
So my archetype command was:
mvn archetype:generate \
-DarchetypeGroupId=org.apache.karaf.archetypes \
-DarchetypeArtifactId=karaf-bundle-archetype \
-DarchetypeVersion=2.2.8 \
-DgroupId=com.mycompany \
-DartifactId=com.mycompany.bundle \
-Dversion=1.0-SNAPSHOT \
-Dpackage=com.mycompany.bundle
Then I entered the newly made project folder: com.mycompany.bundle:
cd com.mycompany.bundle
And a mvn install:
mvn install
Then there is a jar file in the 'target/' folder, which you can install into the Karaf installation as I said before.
New -> Plugin Project -> Choose a name -> check the parameters -> you can use a template if you like.
Select your project -> Export -> Plugin/Fragment -> Choose a folder
There's your jar file.
Upvotes: 6
Reputation: 2748
You can just drop the bundle into the 'deploy' directory, and Karaf just notices and installs it.
Upvotes: 6