In maven projects you have to run mvn install to build your project to the
local repo.

So it is normal that saving a file does not lead to a update of the local
repo. The reason for this is that some maven project take quite a while to
build. So it would not be wise to do that after each save.

It think bndtools at least builds the jar on each save. (This should also
be true if you use the maven setup for your project instead of the
workspace one). I am not sure if it also deploys to the local repo but
maybe it does as it is a cheap operation if the jar is already built. You
should ask this on the bndtools list for clarification.

When you start your project in bndtools from a bndrun then I tested that
saving a file indeed leads to that bundle being updated in the running
process. This also works if bndtools uses the plain maven build.

I am planning to do a webinar with Ray about OSGi development. We will demo
how to debug with bndtools as well as with karaf there. So I think after
the preparation for it we have some good infos how it will actually work.

In the mean time try out the new enroute .. it should not take long to
validate how bndtools behaves with the maven build.

Christian


Am Fr., 15. Feb. 2019 um 14:11 Uhr schrieb Alex Weirig <
[email protected]>:

> Hi Christian,
>
> I'm not sure if I'm missing something obvious ... in my project I have a
> few bundles that have to be maven based (Vaadin related projects, so they
> need to build using maven).
>
> When I change code in my regular bndtools workspace related projects,
> whenever I save code it get's automatically build and deployed to my local
> maven repository.
>
> This is unfortunately not the case with the maven projects, I always have
> to manually build the project in order to make it deploy ... and the maven
> build is way slower than the bnd(tools) build... As I only have a couple of
> hours per week to focus on development, I don't want to spend that time
> waiting for maven :-)
>
> Is that different with the "maven build of bndtools" enroute is using...
> I'm ashamed but I still couldn't find the time to look into that new
> approach after Eclipse/OSGi Con last year ... so maybe I'm still
> complaining about things that are actually solved.
>
> Thanks
>
>
> Mat frëndleche Gréiss,
> Mit freundlichen Grüßen,
> Meilleures salutations,
> Kind regards,Alex WeirigResponsable Technique
> Ville de Luxembourg
> Service Enseignement
> Centre Technolink
> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
> [email protected] // www.technolink.lu
>
> Centre Technolink
> 2, rue Charles de Tornaco
> L-2623 LUXEMBOURG
>
> On 15/02/2019 13:03, Christian Schneider wrote:
>
> I agree with Alex about using bundle:watch. It gives you a similar
> experience like bndtools once your bundles are running in karaf.
> To get the bundles running easier I propose you also create a karaf
> feature in your build.
>
> I also propose you move away from the bndtools workspace model and instead
> use the maven build of bndtools like enroute now shows. It is much nearer
> to how karaf projects are built.
>
> One other thing that might come handy is to start karaf with the "debug"
> argument. This opens karaf for remote debugging and allows you to also
> debug your bundles easily. Basically it is like running the bndtools
> starter in debug mode.
>
> Christian
>
> Am Fr., 15. Feb. 2019 um 12:55 Uhr schrieb Alex Weirig <
> [email protected]>:
>
>> 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 WeirigResponsable Technique
>> Ville de Luxembourg
>> Service Enseignement
>> Centre Technolink
>> *Tel* +352 4796 - 6127 <+35247966127>*Fax* +352 42 88 81*Email* 
>> [email protected] // 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é <[email protected]>
>> 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é
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Computer Scientist
> http://www.adobe.com
>
>

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Reply via email to