You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Mike Rumpf <mi...@gmx.de> on 2016/02/11 13:20:06 UTC

[Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Hello guys,

I am building a feature with the karaf-maven-plugin.  I am using a bundle
from maven central which provides an osgi service. But for whatever reason
its manifest doesn't include any Provide-Capability statement. However my
application bundle which uses the service has a corresponding
Require-Capability manifest entry for that service (added automatically via
the maven bundle plugin). Therefore building my assembly fails with a
corresponding "missing requirement" error. I helped myself out by "hacking"
the manifest in the library  bundle and adding a "Provide Capability"
manually. But there should be a better way to solve this problem, or?

Any ideas?

Thanks in advance.

Mike



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Milen Dyankov <mi...@gmail.com>.
Another option would be to use fragment bundle. However there are some life
cycle  issues in some corner cases when you use fragments.
11 lut 2016 13:20 "Mike Rumpf" <mi...@gmx.de> napisał(a):

> Hello guys,
>
> I am building a feature with the karaf-maven-plugin.  I am using a bundle
> from maven central which provides an osgi service. But for whatever reason
> its manifest doesn't include any Provide-Capability statement. However my
> application bundle which uses the service has a corresponding
> Require-Capability manifest entry for that service (added automatically via
> the maven bundle plugin). Therefore building my assembly fails with a
> corresponding "missing requirement" error. I helped myself out by "hacking"
> the manifest in the library  bundle and adding a "Provide Capability"
> manually. But there should be a better way to solve this problem, or?
>
> Any ideas?
>
> Thanks in advance.
>
> Mike
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Mike Rumpf <mi...@gmx.de>.
Thanks for the input.

That certainly helped to solve the build issues I had. But I still feel
uncomfortable with having to mingle with the boot stage. For me it would be
much cleaner to start my application features in the startup stage than in
the boot stage. I also would like to keep the strict resolving since I think
it is helpful for indicating problems. Therefore it would be nice to nice to
be able to exclude some dependencies from being verified at build time. But
I am new to karaf/maven. So maybe I am missing some options?



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045309.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by j3rem1e <je...@gmail.com>.
If i can help, i had similar issue with my distribution. if i remember
correctly, the "startup" stage resolve the capability/requirement. you
should move your feature in the boot stage, in order to bypass the resolver.

Moreover, there is some bug in the resolution process. for example, if you
have a feature with prerequisite=true, in the startup stage, then the
resolution failed (the prerequisite is moved in a stage before the startup -
and can't be resolved). The resolver is more strict in a "static" profile
too (because every feature is installed in this startup stage)

Regards,
Jeremie



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045293.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Mike Rumpf <mi...@gmx.de>.
I sent an email to your account. Hope that works.



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045286.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Sorry, the attachments doesn't work on the mailing lists.

Can you send it directly on jbonofre@apache.org ?

Thanks
Regards
JB

On 02/11/2016 03:17 PM, Mike Rumpf wrote:
> Yes, of course. My Assembly pom:
>
>
>
> And here my feature pom:
>
>
>
> Building this, I get the following error:
>
>
> That's not surprising since the db bundle require the EntityManagerFactory
> service and the postgres bundle should provide it but doesn't have the
> necessary Provide-Capability statement in its manifest.
>
> Thanks for looking into it.
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045284.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Mike Rumpf <mi...@gmx.de>.
Yes, of course. My Assembly pom:



And here my feature pom:



Building this, I get the following error:


That's not surprising since the db bundle require the EntityManagerFactory
service and the postgres bundle should provide it but doesn't have the
necessary Provide-Capability statement in its manifest.

Thanks for looking into it.



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045284.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Can you share your pom.xml and features.xml in order for me to reproduce 
your issue ?

Thanks,
Regards
JB

On 02/11/2016 02:31 PM, Mike Rumpf wrote:
> Sorry, if I my words were misleading.
>
> No, I want to build the assembly inside the IDE (eclipse). That fails if any
> dependency cannot be resolved (even if it is provided by the karaf container
> like the osgi.ee capability but missing in the feature and its
> dependencies). I don't know how to tell the karaf-maven-plugin to ignore
> these kind of dependencies when building (Maven Install) the assembly within
> eclipse.
>
> Do you understand what I mean?
>
> Best regards,
> Mike
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045280.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Mike Rumpf <mi...@gmx.de>.
Sorry, if I my words were misleading.

No, I want to build the assembly inside the IDE (eclipse). That fails if any
dependency cannot be resolved (even if it is provided by the karaf container
like the osgi.ee capability but missing in the feature and its
dependencies). I don't know how to tell the karaf-maven-plugin to ignore
these kind of dependencies when building (Maven Install) the assembly within
eclipse.

Do you understand what I mean?

Best regards,
Mike




--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045280.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Mike,

sorry, I wasn't clear.

Basically, I guess that you have the issue when you install the feature 
(at runtime), correct ?
So your feature is not probably "closed", meaning that it doesn't 
install all the capabilities required by bundles inside the feature.

You can also use a resources repository (in 
etc/org.apache.karaf.features.cfg) to provide additional repositories 
providing capabilities (it's an alternative to automatically installed 
bundles).

Does it help ?

Regards
JB

On 02/11/2016 02:19 PM, Mike Rumpf wrote:
> Thanks for the answer.
>
> But actually I don't use the verify goal. I just want to build an assembly.
> But building it fails because of the missing Provide-Capability in one of
> the bundles in the feature.
>
> If the verify goal is performed by default: How would I turn it off?
>
> Best regards,
> Mike
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045277.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Mike Rumpf <mi...@gmx.de>.
Thanks for the answer.

But actually I don't use the verify goal. I just want to build an assembly.
But building it fails because of the missing Provide-Capability in one of
the bundles in the feature. 

If the verify goal is performed by default: How would I turn it off?

Best regards,
Mike



--
View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271p4045277.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: [Karaf-4.0.4] Handling Capabilities with Karaf-Maven-Plugin

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Mike,

the feature doesn't have to include the service Require-Capability as 
it's at bundle level.

However, the verify goal requires the exhaustive list of features.

Regards
JB

On 02/11/2016 01:20 PM, Mike Rumpf wrote:
> Hello guys,
>
> I am building a feature with the karaf-maven-plugin.  I am using a bundle
> from maven central which provides an osgi service. But for whatever reason
> its manifest doesn't include any Provide-Capability statement. However my
> application bundle which uses the service has a corresponding
> Require-Capability manifest entry for that service (added automatically via
> the maven bundle plugin). Therefore building my assembly fails with a
> corresponding "missing requirement" error. I helped myself out by "hacking"
> the manifest in the library  bundle and adding a "Provide Capability"
> manually. But there should be a better way to solve this problem, or?
>
> Any ideas?
>
> Thanks in advance.
>
> Mike
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Karaf-4-0-4-Handling-Capabilities-with-Karaf-Maven-Plugin-tp4045271.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com