Deploy to karaf from maven

@David_Graeff we´ve just had a topic on binding dependencies and jar files. You´ve mentioned the kar files.

I´ve seen that the maven karaf plugin can do remote deployments to a karaf instance. But only if kar files are used…

Do you know if I can change the packaging of my binding to kar and do remote deployment. (Sounds like a quite cool feature and a much better development workflow/experience).

There is a maven goal that I keep forgetting to generate kar files, by the mentioned maven plugin.

But remote deployment is new to me. How does the plugin know where to find the remote karaf instance?

Look at the end of Problems with maven dependencies and bnd

We talked about the whole kar generation (worked for me)

Just have a look at this

Sounds promissing to me. There‘s a run goal too.

If you run Karaf locally and you would like to have hotdeploy then its sufficient to run inside Karaf bundle:watch <binding-bundle-id> or simply watch * if you have bunch of things built within single maven execution.

Best,
Łukasz

And how do I send the changes to the bundle? I guess karaf is waiting for a change in the bundle and then restarts the bundle or do I get it wrong?

Karaf watches the local maven repository (usually in $HOME/.m2 on all operating systems). And Eclipse can be instructed to install a bundle to the local maven repo whenever you click “Debug”. (I think that’s even the default for maven in Eclipse?!)

1 Like

Indeed - you need to install bundle into local maven repository. There are various ways - ie run as > maven build > mvn install. You can also build new snapshot via command line.

That’s really cool. Installing to local maven and using watch seems to be a good way for me… :wink: