Hello.

I've tried using such a template, and all the elements from it are
used, with filtering to generate the result file, but maven
dependencies are not added as bundles to my feature.

It seems that using the template makes the plugin ignore bundles dependencies.

I've tried separating dependent features from my target one like in
your code, but it doesn't work.

My template :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0";
name="${project.parent.artifactId}">
<repository>mvn:org.apache.camel.karaf/apache-camel/${version.of.camel}/xml/features</repository>
<feature name="${project.artifactId}-dependencies" version="${project.version}">
<feature version="${version.of.camel}" prerequisite="false"
dependency="true">camel-blueprint</feature>
</feature>
</features>

My plugin configuration in the pom.xml (the project has "feature" packaging):
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<configuration>
<dependencyFeatures>
<dependencyFeature>${project.artifactId}-dependencies</dependencyFeature>
</dependencyFeatures>
</configuration>
</plugin>

And the result (just the template with filtered values, and nothing
about my own feature) :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0";
name="my-test-26-karaf">
<repository>mvn:org.apache.camel.karaf/apache-camel/2.25.4/xml/features</repository>
<feature name="my-test-26-karaf-x-feature-dependencies"
version="0.0.1-SNAPSHOT">
<feature version="2.25.4" prerequisite="false"
dependency="true">camel-blueprint</feature>
</feature>
</features>

Thanks anyway... More ideas ?

Regards.

Le lun. 8 août 2022 à 19:48, Steinar Bang <s...@dod.no> a écrit :
>
> >>>>> Ephemeris Lappis <ephemeris.lap...@gmail.com>:
>
> > Hello.
> > I can't find any way to add dependent features to the feature I try to
> > generate using the maven plugin.
>
> > The maven dependencies are added as expected with the matching bundles.
>
> > How can I add features ? I've tried putting a feature.xml file in the
> > src/main/feature folder, but then the generation just copy this file
> > and do not update it...
>
> Hm... my template.xml files are expanded the way I expect them to be.
>
> What version of karaf-maven-plugin are you using?
>
> Here is one of my src/main/feature/feature.xml files
>  
> https://github.com/steinarb/liquibase-karaf-feature/blob/master/liquibase-integration-test/karaf.liquibase.sample/src/main/feature/feature.xml#L16
>
> This template feature.xml contains feature dependencies for a feature
> with a name set by the maven property karaf-feature-name, and a
> handwritten jdbc-config feature that depends on the feature with name
> defined by maven property karaf-feature-name and the pax-jdbc-config
> feature.
>
> In addition, the pom.xml for the project defines the karaf-feature-name
> property,
>  
> https://github.com/steinarb/liquibase-karaf-feature/blob/master/liquibase-integration-test/karaf.liquibase.sample/pom.xml#L28
> and a dependency to the liquibase feature (discussed in a different
> thread):
>  
> https://github.com/steinarb/liquibase-karaf-feature/blob/master/liquibase-integration-test/karaf.liquibase.sample/pom.xml#L32
>
> This template is transformed into the following file in 
> target/feature/feature.xml :
>  https://gist.github.com/steinarb/6b49cb2a6eeba74186d754683e97c958
>
>  1. The maven feature dependency of the pom is turned into an import
>      
> https://gist.github.com/steinarb/6b49cb2a6eeba74186d754683e97c958#file-feature-xml-L3
>     and a versioned feature dependency
>      
> https://gist.github.com/steinarb/6b49cb2a6eeba74186d754683e97c958#file-feature-xml-L8
>  2. The feature with name given by maven property karaf-feature-name has
>     the property expanded and gets a description and version values
>     provided by the pom
>  3. The unversioned feature dependencies scr and pax-jdbc-derby are kept
>     from the template feature.xml
>      
> https://gist.github.com/steinarb/6b49cb2a6eeba74186d754683e97c958#file-feature-xml-L6
>  4. The jdbc-config feature "sample-db" is copied from the template
>     feature.xml
>      
> https://gist.github.com/steinarb/6b49cb2a6eeba74186d754683e97c958#file-feature-xml-L11
>

Reply via email to