You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Christian Lutz <Ch...@kreeloo.de> on 2016/05/03 11:36:35 UTC

Add feature to karaf .kar file

Hello,
 
I do have feature.xml as basic for my kar file.
 
<?xml version="1.0" encoding="UTF-8"?>
<features name="spray-server-1.0.0" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0">
 <feature name="spray-server" version="1.0.0">
  <feature>cxf-rs-security-cors</feature>
  <feature>own-adapter-feature</feature>
  <bundle>mvn:de.spray.server/server-orm/1.0.0</bundle>
  <bundle>mvn:de.spray.server/spray-server/1.0.0</bundle>
 </feature>
</features>
 
I create the kar file with karaf-maven-plugin. 
 
 <plugins>
   <plugin>

 <groupId>org.apache.karaf.tooling</groupId>
    <artifactId>karaf-maven-plugin</artifactId>
    <version>4.0.5</version>
    <extensions>true</extensions>
    <configuration>
     <includeTransitiveDependency>false</includeTransitiveDependency>
     <aggregateFeatures>true</aggregateFeatures>
     <addBundlesToPrimaryFeature>true</addBundlesToPrimaryFeature>
    </configuration>
   </plugin>
  </plugins>
 
 
I do have two different feature within my feature.xml cxf-rs-security-cors and own-adapter-feature. 
Is it somehow possible to add all bundles from the own-adapter-feature (but not from cxf-rs-security-cors ) into the kar file? I did expect that this should be possible with aggregateFeatures=true but nothing from own-adapter-feature or cxf-rs-security-cors  had been added. 
 
I also tried to add the feature as dependency within 
 
<dependencies>
  <dependency>
   <groupId>de.spray</groupId>
   <artifactId>own-adapter-feature</artifactId>
   <classifier>features</classifier>
   <version>1.0.0</version>
   <type>xml</type>
   <scope>runtime</scope>
  </dependency>
 </dependencies>
 
But this didn't work either. I do know i could copy alle the dependencies into my own feature.xml but then I do have to care about to features.
 
Thanks
Christian
 
 

Re: Add feature to karaf .kar file

Posted by jonathanknez <jo...@hotmail.com>.
I went ahead and updated our feature.xml template to include the following:

<feature name="myApp" version="myVersion" install="auto">
     <feature>scr</feature>
    
<repository>mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features</repository>
     <bundle>mvn:myCompany/myProject/myVersion</bundle>
</feature> 

I specifically added the bundle that ultimately uses CXF to our feature
file, even though that bundle is already in the features pom.xml as a
dependency. That didn't result in any additional bundles being included in
our KAR. CXF is still not included in the KAR. CXF, like SCR, it not
actually listed as a dependency in any of our bundle pom files. Those
features just need to be there for our stuff to work even though our stuff
does not directly rely on calling into those jars.

 



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Add feature to karaf .kar file

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

Does it change something if you add your app bundle in the myApp feature ?

Let me do a try on my machine and add a new test in Karaf about KAR.

I will eventually create a Jira and share with you here.

I keep you posted.

Regards
JB

On 24/10/2019 02:22, jonathanknez wrote:
> Sorry for reviving an old thread but I am trying to do the same thing
> Christian was. My feature.xml includes the following:
>
> <feature name="myApp" version="myVersion" install="auto">
>      <feature>scr</feature>
>      <feature>cxf-jaxrs</feature>
> </feature>
>
> The bundles for scr and cxf-jaxrs don't get included in my kar. I will be
> installing this kar in a location that has no internet access and no maven
> repo to pull from.
>
> JB, you recommended including the <repository>xxx</repository> in the
> feature xml file. Is this what you had in mind?
>
> <feature name="myApp" version="myVersion" install="auto">
>      <feature>scr</feature>
>     
> <repository>mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features</repository>
> </feature>
>
> The above does not result in any additional bundles being included in the
> KAR. I must not be understanding the solution because the above references
> the CXF feature file that defines a bunch of features, more than just the
> one I need (and its dependencies). Any help would be appreciated.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Add feature to karaf .kar file

Posted by jonathanknez <jo...@hotmail.com>.
Sorry for reviving an old thread but I am trying to do the same thing
Christian was. My feature.xml includes the following:

<feature name="myApp" version="myVersion" install="auto">
    <feature>scr</feature>
    <feature>cxf-jaxrs</feature>
</feature>

The bundles for scr and cxf-jaxrs don't get included in my kar. I will be
installing this kar in a location that has no internet access and no maven
repo to pull from.

JB, you recommended including the <repository>xxx</repository> in the
feature xml file. Is this what you had in mind?

<feature name="myApp" version="myVersion" install="auto">
    <feature>scr</feature>
   
<repository>mvn:org.apache.cxf.karaf/apache-cxf/RELEASE/xml/features</repository>
</feature>

The above does not result in any additional bundles being included in the
KAR. I must not be understanding the solution because the above references
the CXF feature file that defines a bunch of features, more than just the
one I need (and its dependencies). Any help would be appreciated.



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Add feature to karaf .kar file

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

you don't have to gather in an unique feature.

If in your feature, you define the CXF repository:

<repository>mvn...</repository>

then the kar file will include your features XML and all dependencies.

Regards
JB

On 05/03/2016 11:36 AM, Christian Lutz wrote:
> Hello,
> I do have feature.xml as basic for my kar file.
> <?xml version="1.0" encoding="UTF-8"?>
> <features name="spray-server-1.0.0"
> xmlns="http://karaf.apache.org/xmlns/features/v1.3.0">
>   <feature name="spray-server" version="1.0.0">
>    <feature>cxf-rs-security-cors</feature>
>    <feature>own-adapter-feature</feature>
>    <bundle>mvn:de.spray.server/server-orm/1.0.0</bundle>
>    <bundle>mvn:de.spray.server/spray-server/1.0.0</bundle>
>   </feature>
> </features>
> I create the kar file with karaf-maven-plugin.
>   <plugins>
>     <plugin>
>
>   <groupId>org.apache.karaf.tooling</groupId>
>      <artifactId>karaf-maven-plugin</artifactId>
>      <version>4.0.5</version>
>      <extensions>true</extensions>
>      <configuration>
>       <includeTransitiveDependency>false</includeTransitiveDependency>
>       <aggregateFeatures>true</aggregateFeatures>
>       <addBundlesToPrimaryFeature>true</addBundlesToPrimaryFeature>
>      </configuration>
>     </plugin>
>    </plugins>
> I do have two different feature within my
> feature.xml cxf-rs-security-cors and own-adapter-feature.
> Is it somehow possible to add all bundles from
> the own-adapter-feature (but not from cxf-rs-security-cors ) into the
> kar file? I did expect that this should be possible
> with aggregateFeatures=true but nothing from own-adapter-feature or
> cxf-rs-security-cors  had been added.
> I also tried to add the feature as dependency within
> <dependencies>
>    <dependency>
>     <groupId>de.spray</groupId>
>     <artifactId>own-adapter-feature</artifactId>
>     <classifier>features</classifier>
>     <version>1.0.0</version>
>     <type>xml</type>
>     <scope>runtime</scope>
>    </dependency>
>   </dependencies>
> But this didn't work either. I do know i could copy alle the
> dependencies into my own feature.xml but then I do have to care about to
> features.
> Thanks
> Christian

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