Re: Include Karaf feature in POM dependency
On 30/11/17 17:00, Steinar Bang wrote: Kerry: Yes that is what I meant, I have to use a template to create a features.xml. I've looked at the code for GenerateDescriptorMojo and searched the Karaf source for an example of what I need but couldn't find anything. I've created a feature request for this: https://issues.apache.org/jira/browse/KARAF-5512 Using the template technique I've also discovered that when I deployed my feature it can fail. For example if I have 3 of my bundles A, B and C in the feature such that: B depends on a service from C and A depends on B deployment can fail due to a required service from C not being available 'in-time' for B - I think that's what happening. If I deploy the bundles individually everything works. I'll try playing around with it but this is obviously nothing to do with the GenerateDescriptorMojo. Hm... B should be robust enough to handle services arriving at any time and in any order. But if bundle B is outside of your control, then maybe you could force the correct load order in some way...? Maybe a hiearchy of feature dependencies would do the trick? Ie. make a feature for C that loads C. Then make a feature for B that loads bundle B and requires feature C. Then make a feature for A that loads bundle A and requires feature B. Then make your feature be dependent on feature A. Something like that...? Hi Steinar, Sorry taken me a while to get back to you. 1. thanks for raising up the JIRA ticket I also would like to keep my features specification within the POM if possible. 2. Regarding the resolving of bundles in a feature, I don't believe that it's because the bundles are not robust, it's more like the feature deployer within Karaf isn't flexible enough to allow services to become available that are provided within the same feature. I have created an example here : https://github.com/jtkb/jpatest/blob/feature/karaf_features/simple-datasource/src/main/feature/feature.xml If I try to deploy this feature I get the deployment error: resolution:=mandatory [caused by: Unable to resolve com.javatechnics.jpa.simple/1.0.0.SNAPSHOT: missing requirement [com.javatechnics.jpa.simple/1.0.0.SNAPSHOT] osgi.service; objectClass=javax.persistence.spi.PersistenceProvider; javax.persistence.provider=org.apache.openjpa.persistence.PersistenceProviderImpl; effective:=active]] Remove the last bundle from the features.xml ('simple'), deploy the feature and THEN install the 'simple' bundle manually it all works fine. Unless I am configuring my feature incorrectly there doesn't seem to be a way of including DAO/persistence unit bundle AND the datasource bundle within the same feature. Kerry
Re: Include Karaf feature in POM dependency
> Kerry: > Yes that is what I meant, I have to use a template to create a > features.xml. I've looked at the code for GenerateDescriptorMojo and > searched the Karaf source for an example of what I need but couldn't > find anything. I've created a feature request for this: https://issues.apache.org/jira/browse/KARAF-5512 > Using the template technique I've also discovered that when I deployed > my feature it can fail. For example if I have 3 of my bundles A, B and > C in the feature such that: > B depends on a service from C and A depends on B > deployment can fail due to a required service from C not being > available 'in-time' for B - I think that's what happening. If I deploy > the bundles individually everything works. I'll try playing around > with it but this is obviously nothing to do with the > GenerateDescriptorMojo. Hm... B should be robust enough to handle services arriving at any time and in any order. But if bundle B is outside of your control, then maybe you could force the correct load order in some way...? Maybe a hiearchy of feature dependencies would do the trick? Ie. make a feature for C that loads C. Then make a feature for B that loads bundle B and requires feature C. Then make a feature for A that loads bundle A and requires feature B. Then make your feature be dependent on feature A. Something like that...?
Re: Include Karaf feature in POM dependency
On 26/11/17 07:47, Steinar Bang wrote: Jean-Baptiste Onofré: The generate-descriptor MOJO (or if you use the feature packaging) will create a feature.xml. Yes. But what he was saying, was that the generate-descriptor doesn't use somefeature from the karaf-maven-plugin as dependencies. It only uses those dependencies found in a template.xml. And since I prefer to have all of the config in the POM instead of some in the POM and some in a different place, I thought that was a good idea. The OP offered to make a PR for the change. - Steinar Steinar, Yes that is what I meant, I have to use a template to create a features.xml. I've looked at the code for GenerateDescriptorMojo and searched the Karaf source for an example of what I need but couldn't find anything. Using the template technique I've also discovered that when I deployed my feature it can fail. For example if I have 3 of my bundles A, B and C in the feature such that: B depends on a service from C and A depends on B deployment can fail due to a required service from C not being available 'in-time' for B - I think that's what happening. If I deploy the bundles individually everything works. I'll try playing around with it but this is obviously nothing to do with the GenerateDescriptorMojo. Kerry
Re: Include Karaf feature in POM dependency
> Jean-Baptiste Onofré: > The generate-descriptor MOJO (or if you use the feature packaging) > will create a feature.xml. Yes. But what he was saying, was that the generate-descriptor doesn't use somefeature from the karaf-maven-plugin as dependencies. It only uses those dependencies found in a template.xml. And since I prefer to have all of the config in the POM instead of some in the POM and some in a different place, I thought that was a good idea. The OP offered to make a PR for the change. - Steinar
Re: Include Karaf feature in POM dependency
The generate-descriptor MOJO (or if you use the feature packaging) will create a feature.xml. It's what we are using internally in Karaf. Regards JB On 11/25/2017 11:00 AM, Kerry wrote: Thanks JB. I have a feeling I've asked this already but I think the plug-in options are aimed at building a KAR? I just want to create a features file with the included feature dependencies. I think the only way to do this is to provide a template features XML file? I was going to see if I can tweak the karaf-maven-plugin to do as I want. Would this be of interest as a possible PR? Kerry On 24/11/17 19:43, Jean-Baptiste Onofré wrote: Hi, The karaf-maven-plugin support tag. Regards JB On 11/24/2017 07:50 PM, Kerry wrote: Hi, I'm trying to specify Karaf feature dependencies in my POM so that I can generate a features XML for my own bundle that will install the features as well. How do I specify for example the pax-jdbc-mariadb feature with Maven coordinates? It's part of the enterprise feature I believe but I don't want to install all of enterprise, so how can I install individual features? thanks, Kerry -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com
Re: Include Karaf feature in POM dependency
Hi, The karaf-maven-plugin support tag. Regards JB On 11/24/2017 07:50 PM, Kerry wrote: Hi, I'm trying to specify Karaf feature dependencies in my POM so that I can generate a features XML for my own bundle that will install the features as well. How do I specify for example the pax-jdbc-mariadb feature with Maven coordinates? It's part of the enterprise feature I believe but I don't want to install all of enterprise, so how can I install individual features? thanks, Kerry -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com