Hi JB,

I deep a bit into the code and the issue seems to come from the
class GenerateDescriptorMojo :

if (this.dependencyHelper.isArtifactAFeature(artifact)) {
                if (aggregateFeatures &&
FEATURE_CLASSIFIER.equals(this.dependencyHelper.getClassifier(artifact))) {
                    File featuresFile =
this.dependencyHelper.resolve(artifact, getLog());
                    if (featuresFile == null || !featuresFile.exists()) {
                        throw new MojoExecutionException("Cannot locate
file for feature: " + artifact + " at " + featuresFile);
                    }
                    Features includedFeatures =
readFeaturesFile(featuresFile);
                    //TODO check for duplicates?

features.getFeature().addAll(includedFeatures.getFeature());
                }
            }

We see that the features are aggregated but not the repositories.
Apparently, for the goal features-generate-descriptor, it seems that the
repository tag is simply not use, whatever the options you choose.

Regards,

Arnaud

On Sun, Nov 22, 2015 at 10:19 PM Arnaud Deprez <[email protected]>
wrote:

> Here is the example :
> https://github.com/arnaud-deprez/karaf-maven-plugin-samples
>
> So after performing mvn install, the feature.xml generated in
> aggregate-features/target/feature/feature.xml doesn't contain the
> repository tag from the features.xml from module feature2.
>
> Rgds,
>
> Arnaud
>
> On Sun, Nov 22, 2015 at 9:34 PM Jean-Baptiste Onofré <[email protected]>
> wrote:
>
>> That would be great. Else I will do it myself.
>>
>> Regards
>> JB
>>
>> On 11/22/2015 09:28 PM, Arnaud Deprez wrote:
>> > Sure but I can't give the whole project as it's a corporate project and
>> > I'm not allowed to that.
>> > If you need a whole project, I can try to reproduce it and push it my
>> > github.
>> >
>> > - features1.xml is the feature from the first project
>> > - features2.xml is the feature from my module in the second project
>> > - pom.xml is the pom my distribution module
>> >
>> > Rgds,
>> >
>> > Arnaud
>> >
>> > On Sun, Nov 22, 2015 at 9:14 PM Jean-Baptiste Onofré <[email protected]
>> > <mailto:[email protected]>> wrote:
>> >
>> >     Can you share the pom.xml and features.xml ?
>> >
>> >     Regards
>> >     JB
>> >
>> >     On 11/22/2015 09:11 PM, Arnaud Deprez wrote:
>> >      > Hi JB,
>> >      >
>> >      > Sorry, I don't get what you mean by template or dependencies set.
>> >      >
>> >      > So basically, in my second project, I have a features maven
>> >     module where
>> >      > I'm defining the features.xml file. This file is templated with
>> maven
>> >      > properties and I use the maven resource plugin to replace
>> properties
>> >      > with maven property placeholder.
>> >      >
>> >      > Then, I have another module distribution where my configuration
>> is :
>> >      >
>> >      > ...
>> >      > <dependencies>
>> >      >          <dependency>
>> >      >              <groupId>${project.groupId}</groupId>
>> >      >              <artifactId>features</artifactId>
>> >      >              <version>${project.version}</version>
>> >      >              <type>xml</type>
>> >      >              <classifier>features</classifier>
>> >      >          </dependency>
>> >      >          <dependency>
>> >      >              <groupId>be.lampiris.pie2.el2</groupId>
>> >      >              <artifactId>el2-common-query-features</artifactId>
>> >      >              <version>${lampiris.query.version}</version>
>> >      >              <type>xml</type>
>> >      >              <classifier>features</classifier>
>> >      >          </dependency>
>> >      >      </dependencies>
>> >      > ...
>> >      >              <plugin>
>> >      >                  <groupId>org.apache.karaf.tooling</groupId>
>> >      >                  <artifactId>karaf-maven-plugin</artifactId>
>> >      >                  <version>${karaf-plugin.version}</version>
>> >      >                  <extensions>true</extensions>
>> >      >                  <executions>
>> >      >                      <execution>
>> >      >                          <id>features-generate-descriptor</id>
>> >      >                          <phase>package</phase>
>> >      >                          <goals>
>> >      >
>> >     <goal>features-generate-descriptor</goal>
>> >      >                          </goals>
>> >      >                          <configuration>
>> >      >
>> >     <aggregateFeatures>true</aggregateFeatures>
>> >      >                          </configuration>
>> >      >                      </execution>
>> >      >                      <execution>
>> >      >                          <id>kar</id>
>> >      >                          <phase>install</phase>
>> >      >                          <goals>
>> >      >                              <goal>kar</goal>
>> >      >                          </goals>
>> >      >                          <configuration>
>> >      >
>> >      >
>> >
>>  
>> <finalName>Lampiris-${project.parent.artifactId}-${project.version}</finalName>
>> >      >
>> >      > <ignoreDependencyFlag>true</ignoreDependencyFlag>
>> >      >
>> >      >
>> >
>>  <featuresFile>${project.build.directory}/feature/feature.xml</featuresFile>
>> >      >                          </configuration>
>> >      >                      </execution>
>> >      >                  </executions>
>> >      >              </plugin>
>> >      > ...
>> >      >
>> >      > So I use dependencies to import my 2 features files.
>> >      > Does it help ?
>> >      >
>> >      > Regards,
>> >      >
>> >      > Arnaud
>> >      >
>> >      > On Sun, Nov 22, 2015 at 8:51 PM Jean-Baptiste Onofré
>> >     <[email protected] <mailto:[email protected]>
>> >      > <mailto:[email protected] <mailto:[email protected]>>> wrote:
>> >      >
>> >      >     Hi Arnaud,
>> >      >
>> >      >     Hmmm, it sounds like a bug.
>> >      >
>> >      >     Do you use a template for the generate descriptor or does it
>> >     use the
>> >      >     dependencies set ?
>> >      >
>> >      >     Regards
>> >      >     JB
>> >      >
>> >      >     On 11/22/2015 08:34 PM, Arnaud Deprez wrote:
>> >      >      > Hi folks,
>> >      >      >
>> >      >      > I'm trying to use the karaf-maven-plugin to generate a kar
>> >     file.
>> >      >      >
>> >      >      > Here is my configuration:
>> >      >      > I have 2 projects, one depends on the other. Each project
>> >     has its own
>> >      >      > feature file.
>> >      >      > In my second project, I defined the following
>> configuration :
>> >      >      > <plugin>
>> >      >      >
>> <groupId>org.apache.karaf.tooling</groupId>
>> >      >      >
>> <artifactId>karaf-maven-plugin</artifactId>
>> >      >      >
>> <version>${karaf-plugin.version}</version>
>> >      >      >                  <extensions>true</extensions>
>> >      >      >                  <executions>
>> >      >      >                      <execution>
>> >      >      >
>> <id>features-generate-descriptor</id>
>> >      >      >                          <phase>package</phase>
>> >      >      >                          <goals>
>> >      >      >
>> >      >     <goal>features-generate-descriptor</goal>
>> >      >      >                          </goals>
>> >      >      >                          <configuration>
>> >      >      >
>> >      >     <aggregateFeatures>true</aggregateFeatures>
>> >      >      >                          </configuration>
>> >      >      >                      </execution>
>> >      >      >                      <execution>
>> >      >      >                          <id>kar</id>
>> >      >      >                          <phase>install</phase>
>> >      >      >                          <goals>
>> >      >      >                              <goal>kar</goal>
>> >      >      >                          </goals>
>> >      >      >                          <configuration>
>> >      >      >
>> >      >      >
>> >      >
>> >
>>  
>> <finalName>Lampiris-${project.parent.artifactId}-${project.version}</finalName>
>> >      >      >
>> >      >      > <ignoreDependencyFlag>true</ignoreDependencyFlag>
>> >      >      >
>> >      >      >
>> >      >
>> >
>>  
>> <!--<featuresFile>${project.build.directory}/classes/features.xml</featuresFile>-->
>> >      >      >
>> >      >      >
>> >      >
>> >
>>  <featuresFile>${project.build.directory}/feature/feature.xml</featuresFile>
>> >      >      >                          </configuration>
>> >      >      >                      </execution>
>> >      >      >                  </executions>
>> >      >      >              </plugin>
>> >      >      >
>> >      >      > As I've imported the 2 features files in my dependencies,
>> it
>> >      >     works fine.
>> >      >      > Except that in the second feature, I've defined
>> >     <repository> (for
>> >      >      > example to choose the right camel version) and those tags
>> >     aren't
>> >      >      > aggregated in the final feature.xml generated.
>> >      >      >
>> >      >      > I didn't find any useful information to achieve that in
>> the
>> >      >      > documentation. So that's my question : is there a way to
>> also
>> >      >     aggregate
>> >      >      > repository tags ?
>> >      >      >
>> >      >      > Regards,
>> >      >      >
>> >      >      > Arnaud
>> >      >
>> >      >     --
>> >      >     Jean-Baptiste Onofré
>> >      > [email protected] <mailto:[email protected]>
>> >     <mailto:[email protected] <mailto:[email protected]>>
>> >      > http://blog.nanthrax.net
>> >      >     Talend - http://www.talend.com
>> >      >
>> >
>> >     --
>> >     Jean-Baptiste Onofré
>> >     [email protected] <mailto:[email protected]>
>> >     http://blog.nanthrax.net
>> >     Talend - http://www.talend.com
>> >
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>

Reply via email to