Hi Kamil,

let me try and see if this can already help you, it's very basic but works really fine depending on the scope / size of your development project ... this is based on bnd(tools) 4.0.0 but should still be valid in 4.1.0 I guess.

If you look at your build.bnd file in your bndtools workspace, make sure you have the following plugin defined:

-plugin.5.LocalMaven: \
aQute.bnd.repository.maven.provider.MavenBndRepository; \
        name = *LocalMaven*

then you define the buildRepo:

-buildrepo: \
*LocalMaven*

finally set some maven data:

-pom: \
    groupid    = *your.group*,\
    version =    ${versionmask;===;${@version}}-SNAPSHOT


Now when bnd(tools) builds your project it should end up in your local maven repository (your home folder/.m2/repository/*your/group*). So no need to gradle here.

You can now run a karaf on your local machine and install your bundles using:

bundle:install mvn:your.group/your bundle name here/version here

as you're doing right now.

Now you can tell karaf to monitor your bundles:

bundle:watch --start *

Thus, whenever you change any line of code in your Eclipse, bnd(tools) will compile the code, build the bundle and deploy it to your local maven repo. Karaf will notice the change and update the bundle to the latest version. You can return to karaf and immediately test your updated code.

I find this is a really nice and efficient way to do development without too much overhead (well you need to run the bundle:watch --start * after every restart of karaf but maybe there's also a way to work around it.

You don't have to deal with maven (which I am convinced is more of a problem than a solution), except for setting your groupid and version pattern and having the build bundles deployed in your local maven repository.

I'm sure this is not a valid approach if you're working with a large team where everybody needs to rely on somebody else's code and you have a complete CI chain etc etc.


You can improve deployment by building a karaf feature (https://karaf.apache.org/manual/latest/provisioning), that's merely an xml file using your local maven repo to retrieve the bundle.

You create your feature_file.xml, copy it to the "deploy" folder in karaf and then run a feature:install your_feature_name to install one of the features containing the different bundles.

Hope it helps ... hope it is not too basic for your needs.

Mat frëndleche Gréiss, Mit freundlichen Grüßen, Meilleures salutations, Kind regards,
Alex Weirig
Responsable Technique Ville de Luxembourg Service Enseignement Centre Technolink *Tel* +352 4796 - 6127 <tel:+35247966127> *Fax* +352 42 88 81 *Email* alex.wei...@technolink.lu <mailto:alex.wei...@technolink.lu> www.vdl.lu <http://www.vdl.lu> // www.technolink.lu <http://www.technolink.lu> Centre Technolink 2, rue Charles de Tornaco L-2623 LUXEMBOURG

On 15/02/2019 12:29, Kamil Paśko wrote:
Dear JB,

> Do you already know what you have in mind (if you could describe the use
case, that would be great) ?

I know that this could be silly problem, but I'm new to Karaf, new to Bndtools and new to OSGi (I begun my research week ago).
That is why I decided to search for tutorials and examples first.
But if you ask (it's very kind), then I have two use cases:

Case 1:
Background:
I've learnt how to use Bndtools workspace in Eclipse and how to run examples directly in Eclipse IDE (https://bndtools.org/tutorial.html).
Unfortunatelly, default OSGi runtime is Felix with Gogo shell.
Problem:
How to configure Bndtools workspace to use Karaf (that I have somewhere in my filesystem) instead of default Felix runtime?

Case 2:
Background
I've learn how to use Bnd Gradle plugin (https://github.com/bndtools/bnd/tree/master/biz.aQute.bnd.gradle#replacing-use-of-gradles-deprecated-osgi-plugin) to create bundles and I used Gradle's maven publish plugin to publish them to Maven's local repo. Then I install them in Karaf one by one using bundle:install mvn:xxx/yyy/zzz command
Problem:
a) How to create set of bundles (feature) in Bnd?
b) How to deploy this to Karaf without manually executing bundle:install commands?

Thank you in advance,
Kamil


On Thu, Feb 14, 2019 at 1:37 PM Jean-Baptiste Onofré <j...@nanthrax.net <mailto:j...@nanthrax.net>> wrote:

    Hi,

    We didn't move forward a lot. I remember there was some discussion to
    have a "Karaf exporter" in bndtools and I proposed my help on this.
    I didn't move forward yet.

    Do you already know what you have in mind (if you could describe
    the use
    case, that would be great) ?

    Regards
    JB

    On 14/02/2019 13:20, kamilantlgc wrote:
    > Dear Karaf User group,
    >
    > I have stumbled upon the exact problem - how to join Karaf and
    Bndtools
    > together "the right way" (this conversation is the first result
    in Google by
    > the way: https://www.google.com/search?q=karaf+bnd).
    >
    > I've read the topic and was happy to see that Guillaume asked to
    fill Jira
    > issue.
    > Then I've read with interest that JB is just "building the new
    SNAPSHOT to
    > test if the couple of issues".
    > And then I navigated to the issue created by dleangen
    > (https://issues.apache.org/jira/browse/KARAF-4160) just to see
    that it's
    > status is "Won't fix"...
    >
    > Anyway - does anybody on this group already figured it out how
    to join Karaf
    > and Bnd to play nicely together?
    >
    > Kind regards,
    > Kamil
    >
    >
    >
    > --
    > Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
    >

-- Jean-Baptiste Onofré
    jbono...@apache.org <mailto:jbono...@apache.org>
    http://blog.nanthrax.net
    Talend - http://www.talend.com

<<attachment: alex_weirig.vcf>>

Reply via email to