You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Giacomo Coletta <co...@gmail.com> on 2012/10/19 11:16:20 UTC

Kar features.xml file is not filtered

Hi,

i started using the KARs archives, and creates a few KARS using the KAR
archetype.

one problem I encountered is that the features.xml file included in the kar
in the generated maven project doesn't seem to be maven filtered by default.
I would like it to be filtered for managing the included karaf features and
bundles versions using maven properties like in the following example:

<features name="myfeatures-repo" version="${myfeatures-repo.version}">
    <feature name="myfeature" version="${myfeature.version}">
          <bundle>
mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>

    </feature>
</features>

i was able to do this while including the features in an assembly using the
add-features-to-repo goal of the features-maven-plugin (features.xml was
filtered by default)

I tried to do the same with kars, but I was not able to get to this result
quickly.
May be this is related to the fact that in the features-maven-pluging the
create-kar goal is tied to the package phase, while
the add-features-to-repo was in the compile phase.


Does anybody know a standard or easy way to have the features.xml file
maven filtered in KARs ?

Many Thanks

Giacomo

Re: Kar features.xml file is not filtered

Posted by Giacomo Coletta <co...@gmail.com>.
OK, now it works !

Many thanks

Giacomo

2012/10/22 Christoph Gritschenberger <ch...@gmail.com>

> Hi,
>
> Just remembered, we specifically attach the execution of the
> resource-plugin to the "generate-resources"-phase like this:
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-resources-plugin</artifactId>
>         <executions>
>           <execution>
>             <id>filter</id>
>             <phase>generate-resources</phase>
>             <goals>
>               <goal>resources</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
> That way the filtered features.xml is created way earlier in the
> build-process and available when the assembly is created.
>
> kind regards,
> christoph
>
> On 22/10/12 15:33, Giacomo Coletta wrote:
> > The build fails because of  the error and there is no target directory at
> > all.
> >
> > 2012/10/22 Christoph Gritschenberger <
> christoph.gritschenberger@gmail.com>
> >
> >> And is the file actually not there?
> >> Is it nowhere in the target-directory?
> >>
> >> kind regards,
> >> christoph
> >>
> >> On 22/10/12 14:51, Giacomo Coletta wrote:
> >>> hi,
> >>>
> >>> this does not work for me.
> >>>
> >>> The message i get is:
> >>>
> >>> [ERROR] Failed to execute goal
> >>> org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar
> >>> (create-kar) on project kar.rttr: Could not interpret features XML
> file:
> >>>
> >>
> C:\DEV3\Sources\RTTR\osgi.rttr.repo\karaf\kars\kar.rttr\target\classes\feature.xml
> >>> (Impossible to find the specified path) :
> >>>
> >>
> file:/C:/DEV3/Sources/RTTR/osgi.rttr.repo/karaf/kars/kar.rttr/target/classes/feature.xml
> >>> -> [Help 1]
> >>>
> >>> 2012/10/19 Michael Täschner <m....@gmail.com>
> >>>
> >>>> Hi,
> >>>>
> >>>> pick up the filtered file from the target folder. Here's my example
> >> config:
> >>>>
> >>>>
> >>>>       <plugin>
> >>>>         <groupId>org.apache.karaf.tooling</groupId>
> >>>>         <artifactId>features-maven-plugin</artifactId>
> >>>>         <extensions>true</extensions>
> >>>>
> >>>>         <executions>
> >>>>           <execution>
> >>>>             <id>create-kar</id>
> >>>>             <phase>process-resources</phase>
> >>>>
> >>>>             <goals>
> >>>>               <goal>create-kar</goal>
> >>>>             </goals>
> >>>>             <configuration>
> >>>>
> >>>> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
> >>>>               <includeDependencies>false</includeDependencies>
> >>>>
> >>>>
> >>
> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
> >>>>             </configuration>
> >>>>           </execution>
> >>>>         </executions>
> >>>>       </plugin>
> >>>>
> >>>> Regards,
> >>>> Michael
> >>>>
> >>>> P.S.: I do not actually remember why I added the /doesNotExist folder
> >>>> though but feature.xml is located in src/main/resourses
> >>>>
> >>>>
> >>>> 2012/10/19 Giacomo Coletta <co...@gmail.com>
> >>>>
> >>>>> This was more or less what I already tried, but alone does not work.
> >>>>>
> >>>>> it seem that the resources:resources goal is not executed during
> >>>>> packaging with  <packaging>pom</packaging> (while it is with jars).
> >>>>>
> >>>>> i tried a bit more and in the end find something working (even if
> >> doesn't
> >>>>> look so clean):
> >>>>>
> >>>>>  <build>
> >>>>>         <resources>
> >>>>>             <resource>
> >>>>>
> >>>>> <directory>${project.basedir}/src/main/feature/</directory>
> >>>>>                 <filtering>true</filtering>
> >>>>>                 <includes>
> >>>>>                     <include>**/*</include>
> >>>>>                 </includes>
> >>>>>
> >>>>> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
> >>>>>             </resource>
> >>>>>         </resources>
> >>>>>         <plugins>
> >>>>>             <plugin>
> >>>>>                 <groupId>org.apache.maven.plugins</groupId>
> >>>>>                 <artifactId>maven-resources-plugin</artifactId>
> >>>>>                 <version>${maven-resources-plugin.version}</version>
> >>>>>                 <executions>
> >>>>>                     <execution>
> >>>>>                         <id>filter</id>
> >>>>>                         <phase>generate-resources</phase>
> >>>>>                         <goals>
> >>>>>                             <goal>resources</goal>
> >>>>>                         </goals>
> >>>>>                     </execution>
> >>>>>                 </executions>
> >>>>>             </plugin>
> >>>>>             <plugin>
> >>>>>                 <groupId>org.apache.karaf.tooling</groupId>
> >>>>>                 <artifactId>features-maven-plugin</artifactId>
> >>>>>                 <version>2.2.9</version>
> >>>>>                 <executions>
> >>>>>                     <execution>
> >>>>>                         <id>create-kar</id>
> >>>>>                         <goals>
> >>>>>                             <goal>create-kar</goal>
> >>>>>                         </goals>
> >>>>>                         <configuration>
> >>>>>
> >>>>>
> >>>>>
> >>
> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
> >>>>>                         </configuration>
> >>>>>
> >>>>>                     </execution>
> >>>>>                 </executions>
> >>>>>             </plugin>
> >>>>>         </plugins>
> >>>>>     </build>
> >>>>>
> >>>>> Thanks anyway.
> >>>>>
> >>>>> Giacomo
> >>>>>
> >>>>> 2012/10/19 Christoph Gritschenberger <
> >> christoph.gritschenberger@gmail.com
> >>>>>>
> >>>>>
> >>>>>> You need to enable resource-filtering in your maven-build. You can
> set
> >>>>>> this up in your pom.xml like this:
> >>>>>>
> >>>>>> ...
> >>>>>>   <build>
> >>>>>>     <resources>
> >>>>>>       <resource>
> >>>>>>
> >>>>>>
> <directory>${project.basedir}/src/main/filtered-resources</directory>
> >>>>>>         <filtering>true</filtering>
> >>>>>>         <includes>
> >>>>>>           <include>**/*</include>
> >>>>>>         </includes>
> >>>>>>       </resource>
> >>>>>>     </resources>
> >>>>>>     ...
> >>>>>>   </build>
> >>>>>> ...
> >>>>>>
> >>>>>> kind regards,
> >>>>>> christoph
> >>>>>>
> >>>>>> On 19/10/12 11:16, Giacomo Coletta wrote:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> i started using the KARs archives, and creates a few KARS using the
> >> KAR
> >>>>>>> archetype.
> >>>>>>>
> >>>>>>> one problem I encountered is that the features.xml file included in
> >>>>>> the kar
> >>>>>>> in the generated maven project doesn't seem to be maven filtered by
> >>>>>> default.
> >>>>>>> I would like it to be filtered for managing the included karaf
> >>>>>> features and
> >>>>>>> bundles versions using maven properties like in the following
> >> example:
> >>>>>>>
> >>>>>>> <features name="myfeatures-repo"
> >> version="${myfeatures-repo.version}">
> >>>>>>>     <feature name="myfeature" version="${myfeature.version}">
> >>>>>>>           <bundle>
> >>>>>>>
> mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
> >>>>>>>
> >>>>>>>     </feature>
> >>>>>>> </features>
> >>>>>>>
> >>>>>>> i was able to do this while including the features in an assembly
> >>>>>> using the
> >>>>>>> add-features-to-repo goal of the features-maven-plugin
> (features.xml
> >>>>>> was
> >>>>>>> filtered by default)
> >>>>>>>
> >>>>>>> I tried to do the same with kars, but I was not able to get to this
> >>>>>> result
> >>>>>>> quickly.
> >>>>>>> May be this is related to the fact that in the
> features-maven-pluging
> >>>>>> the
> >>>>>>> create-kar goal is tied to the package phase, while
> >>>>>>> the add-features-to-repo was in the compile phase.
> >>>>>>>
> >>>>>>>
> >>>>>>> Does anybody know a standard or easy way to have the features.xml
> >> file
> >>>>>>> maven filtered in KARs ?
> >>>>>>>
> >>>>>>> Many Thanks
> >>>>>>>
> >>>>>>> Giacomo
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >>
> >>
> >
>
>
>

Re: Kar features.xml file is not filtered

Posted by Christoph Gritschenberger <ch...@gmail.com>.
Hi,

Just remembered, we specifically attach the execution of the
resource-plugin to the "generate-resources"-phase like this:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

That way the filtered features.xml is created way earlier in the
build-process and available when the assembly is created.

kind regards,
christoph

On 22/10/12 15:33, Giacomo Coletta wrote:
> The build fails because of  the error and there is no target directory at
> all.
> 
> 2012/10/22 Christoph Gritschenberger <ch...@gmail.com>
> 
>> And is the file actually not there?
>> Is it nowhere in the target-directory?
>>
>> kind regards,
>> christoph
>>
>> On 22/10/12 14:51, Giacomo Coletta wrote:
>>> hi,
>>>
>>> this does not work for me.
>>>
>>> The message i get is:
>>>
>>> [ERROR] Failed to execute goal
>>> org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar
>>> (create-kar) on project kar.rttr: Could not interpret features XML file:
>>>
>> C:\DEV3\Sources\RTTR\osgi.rttr.repo\karaf\kars\kar.rttr\target\classes\feature.xml
>>> (Impossible to find the specified path) :
>>>
>> file:/C:/DEV3/Sources/RTTR/osgi.rttr.repo/karaf/kars/kar.rttr/target/classes/feature.xml
>>> -> [Help 1]
>>>
>>> 2012/10/19 Michael Täschner <m....@gmail.com>
>>>
>>>> Hi,
>>>>
>>>> pick up the filtered file from the target folder. Here's my example
>> config:
>>>>
>>>>
>>>>       <plugin>
>>>>         <groupId>org.apache.karaf.tooling</groupId>
>>>>         <artifactId>features-maven-plugin</artifactId>
>>>>         <extensions>true</extensions>
>>>>
>>>>         <executions>
>>>>           <execution>
>>>>             <id>create-kar</id>
>>>>             <phase>process-resources</phase>
>>>>
>>>>             <goals>
>>>>               <goal>create-kar</goal>
>>>>             </goals>
>>>>             <configuration>
>>>>
>>>> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
>>>>               <includeDependencies>false</includeDependencies>
>>>>
>>>>
>> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
>>>>             </configuration>
>>>>           </execution>
>>>>         </executions>
>>>>       </plugin>
>>>>
>>>> Regards,
>>>> Michael
>>>>
>>>> P.S.: I do not actually remember why I added the /doesNotExist folder
>>>> though but feature.xml is located in src/main/resourses
>>>>
>>>>
>>>> 2012/10/19 Giacomo Coletta <co...@gmail.com>
>>>>
>>>>> This was more or less what I already tried, but alone does not work.
>>>>>
>>>>> it seem that the resources:resources goal is not executed during
>>>>> packaging with  <packaging>pom</packaging> (while it is with jars).
>>>>>
>>>>> i tried a bit more and in the end find something working (even if
>> doesn't
>>>>> look so clean):
>>>>>
>>>>>  <build>
>>>>>         <resources>
>>>>>             <resource>
>>>>>
>>>>> <directory>${project.basedir}/src/main/feature/</directory>
>>>>>                 <filtering>true</filtering>
>>>>>                 <includes>
>>>>>                     <include>**/*</include>
>>>>>                 </includes>
>>>>>
>>>>> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
>>>>>             </resource>
>>>>>         </resources>
>>>>>         <plugins>
>>>>>             <plugin>
>>>>>                 <groupId>org.apache.maven.plugins</groupId>
>>>>>                 <artifactId>maven-resources-plugin</artifactId>
>>>>>                 <version>${maven-resources-plugin.version}</version>
>>>>>                 <executions>
>>>>>                     <execution>
>>>>>                         <id>filter</id>
>>>>>                         <phase>generate-resources</phase>
>>>>>                         <goals>
>>>>>                             <goal>resources</goal>
>>>>>                         </goals>
>>>>>                     </execution>
>>>>>                 </executions>
>>>>>             </plugin>
>>>>>             <plugin>
>>>>>                 <groupId>org.apache.karaf.tooling</groupId>
>>>>>                 <artifactId>features-maven-plugin</artifactId>
>>>>>                 <version>2.2.9</version>
>>>>>                 <executions>
>>>>>                     <execution>
>>>>>                         <id>create-kar</id>
>>>>>                         <goals>
>>>>>                             <goal>create-kar</goal>
>>>>>                         </goals>
>>>>>                         <configuration>
>>>>>
>>>>>
>>>>>
>> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
>>>>>                         </configuration>
>>>>>
>>>>>                     </execution>
>>>>>                 </executions>
>>>>>             </plugin>
>>>>>         </plugins>
>>>>>     </build>
>>>>>
>>>>> Thanks anyway.
>>>>>
>>>>> Giacomo
>>>>>
>>>>> 2012/10/19 Christoph Gritschenberger <
>> christoph.gritschenberger@gmail.com
>>>>>>
>>>>>
>>>>>> You need to enable resource-filtering in your maven-build. You can set
>>>>>> this up in your pom.xml like this:
>>>>>>
>>>>>> ...
>>>>>>   <build>
>>>>>>     <resources>
>>>>>>       <resource>
>>>>>>
>>>>>> <directory>${project.basedir}/src/main/filtered-resources</directory>
>>>>>>         <filtering>true</filtering>
>>>>>>         <includes>
>>>>>>           <include>**/*</include>
>>>>>>         </includes>
>>>>>>       </resource>
>>>>>>     </resources>
>>>>>>     ...
>>>>>>   </build>
>>>>>> ...
>>>>>>
>>>>>> kind regards,
>>>>>> christoph
>>>>>>
>>>>>> On 19/10/12 11:16, Giacomo Coletta wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> i started using the KARs archives, and creates a few KARS using the
>> KAR
>>>>>>> archetype.
>>>>>>>
>>>>>>> one problem I encountered is that the features.xml file included in
>>>>>> the kar
>>>>>>> in the generated maven project doesn't seem to be maven filtered by
>>>>>> default.
>>>>>>> I would like it to be filtered for managing the included karaf
>>>>>> features and
>>>>>>> bundles versions using maven properties like in the following
>> example:
>>>>>>>
>>>>>>> <features name="myfeatures-repo"
>> version="${myfeatures-repo.version}">
>>>>>>>     <feature name="myfeature" version="${myfeature.version}">
>>>>>>>           <bundle>
>>>>>>> mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
>>>>>>>
>>>>>>>     </feature>
>>>>>>> </features>
>>>>>>>
>>>>>>> i was able to do this while including the features in an assembly
>>>>>> using the
>>>>>>> add-features-to-repo goal of the features-maven-plugin (features.xml
>>>>>> was
>>>>>>> filtered by default)
>>>>>>>
>>>>>>> I tried to do the same with kars, but I was not able to get to this
>>>>>> result
>>>>>>> quickly.
>>>>>>> May be this is related to the fact that in the features-maven-pluging
>>>>>> the
>>>>>>> create-kar goal is tied to the package phase, while
>>>>>>> the add-features-to-repo was in the compile phase.
>>>>>>>
>>>>>>>
>>>>>>> Does anybody know a standard or easy way to have the features.xml
>> file
>>>>>>> maven filtered in KARs ?
>>>>>>>
>>>>>>> Many Thanks
>>>>>>>
>>>>>>> Giacomo
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
> 



Re: Kar features.xml file is not filtered

Posted by Giacomo Coletta <co...@gmail.com>.
The build fails because of  the error and there is no target directory at
all.

2012/10/22 Christoph Gritschenberger <ch...@gmail.com>

> And is the file actually not there?
> Is it nowhere in the target-directory?
>
> kind regards,
> christoph
>
> On 22/10/12 14:51, Giacomo Coletta wrote:
> > hi,
> >
> > this does not work for me.
> >
> > The message i get is:
> >
> > [ERROR] Failed to execute goal
> > org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar
> > (create-kar) on project kar.rttr: Could not interpret features XML file:
> >
> C:\DEV3\Sources\RTTR\osgi.rttr.repo\karaf\kars\kar.rttr\target\classes\feature.xml
> > (Impossible to find the specified path) :
> >
> file:/C:/DEV3/Sources/RTTR/osgi.rttr.repo/karaf/kars/kar.rttr/target/classes/feature.xml
> > -> [Help 1]
> >
> > 2012/10/19 Michael Täschner <m....@gmail.com>
> >
> >> Hi,
> >>
> >> pick up the filtered file from the target folder. Here's my example
> config:
> >>
> >>
> >>       <plugin>
> >>         <groupId>org.apache.karaf.tooling</groupId>
> >>         <artifactId>features-maven-plugin</artifactId>
> >>         <extensions>true</extensions>
> >>
> >>         <executions>
> >>           <execution>
> >>             <id>create-kar</id>
> >>             <phase>process-resources</phase>
> >>
> >>             <goals>
> >>               <goal>create-kar</goal>
> >>             </goals>
> >>             <configuration>
> >>
> >> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
> >>               <includeDependencies>false</includeDependencies>
> >>
> >>
> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
> >>             </configuration>
> >>           </execution>
> >>         </executions>
> >>       </plugin>
> >>
> >> Regards,
> >> Michael
> >>
> >> P.S.: I do not actually remember why I added the /doesNotExist folder
> >> though but feature.xml is located in src/main/resourses
> >>
> >>
> >> 2012/10/19 Giacomo Coletta <co...@gmail.com>
> >>
> >>> This was more or less what I already tried, but alone does not work.
> >>>
> >>> it seem that the resources:resources goal is not executed during
> >>> packaging with  <packaging>pom</packaging> (while it is with jars).
> >>>
> >>> i tried a bit more and in the end find something working (even if
> doesn't
> >>> look so clean):
> >>>
> >>>  <build>
> >>>         <resources>
> >>>             <resource>
> >>>
> >>> <directory>${project.basedir}/src/main/feature/</directory>
> >>>                 <filtering>true</filtering>
> >>>                 <includes>
> >>>                     <include>**/*</include>
> >>>                 </includes>
> >>>
> >>> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
> >>>             </resource>
> >>>         </resources>
> >>>         <plugins>
> >>>             <plugin>
> >>>                 <groupId>org.apache.maven.plugins</groupId>
> >>>                 <artifactId>maven-resources-plugin</artifactId>
> >>>                 <version>${maven-resources-plugin.version}</version>
> >>>                 <executions>
> >>>                     <execution>
> >>>                         <id>filter</id>
> >>>                         <phase>generate-resources</phase>
> >>>                         <goals>
> >>>                             <goal>resources</goal>
> >>>                         </goals>
> >>>                     </execution>
> >>>                 </executions>
> >>>             </plugin>
> >>>             <plugin>
> >>>                 <groupId>org.apache.karaf.tooling</groupId>
> >>>                 <artifactId>features-maven-plugin</artifactId>
> >>>                 <version>2.2.9</version>
> >>>                 <executions>
> >>>                     <execution>
> >>>                         <id>create-kar</id>
> >>>                         <goals>
> >>>                             <goal>create-kar</goal>
> >>>                         </goals>
> >>>                         <configuration>
> >>>
> >>>
> >>>
> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
> >>>                         </configuration>
> >>>
> >>>                     </execution>
> >>>                 </executions>
> >>>             </plugin>
> >>>         </plugins>
> >>>     </build>
> >>>
> >>> Thanks anyway.
> >>>
> >>> Giacomo
> >>>
> >>> 2012/10/19 Christoph Gritschenberger <
> christoph.gritschenberger@gmail.com
> >>>>
> >>>
> >>>> You need to enable resource-filtering in your maven-build. You can set
> >>>> this up in your pom.xml like this:
> >>>>
> >>>> ...
> >>>>   <build>
> >>>>     <resources>
> >>>>       <resource>
> >>>>
> >>>> <directory>${project.basedir}/src/main/filtered-resources</directory>
> >>>>         <filtering>true</filtering>
> >>>>         <includes>
> >>>>           <include>**/*</include>
> >>>>         </includes>
> >>>>       </resource>
> >>>>     </resources>
> >>>>     ...
> >>>>   </build>
> >>>> ...
> >>>>
> >>>> kind regards,
> >>>> christoph
> >>>>
> >>>> On 19/10/12 11:16, Giacomo Coletta wrote:
> >>>>> Hi,
> >>>>>
> >>>>> i started using the KARs archives, and creates a few KARS using the
> KAR
> >>>>> archetype.
> >>>>>
> >>>>> one problem I encountered is that the features.xml file included in
> >>>> the kar
> >>>>> in the generated maven project doesn't seem to be maven filtered by
> >>>> default.
> >>>>> I would like it to be filtered for managing the included karaf
> >>>> features and
> >>>>> bundles versions using maven properties like in the following
> example:
> >>>>>
> >>>>> <features name="myfeatures-repo"
> version="${myfeatures-repo.version}">
> >>>>>     <feature name="myfeature" version="${myfeature.version}">
> >>>>>           <bundle>
> >>>>> mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
> >>>>>
> >>>>>     </feature>
> >>>>> </features>
> >>>>>
> >>>>> i was able to do this while including the features in an assembly
> >>>> using the
> >>>>> add-features-to-repo goal of the features-maven-plugin (features.xml
> >>>> was
> >>>>> filtered by default)
> >>>>>
> >>>>> I tried to do the same with kars, but I was not able to get to this
> >>>> result
> >>>>> quickly.
> >>>>> May be this is related to the fact that in the features-maven-pluging
> >>>> the
> >>>>> create-kar goal is tied to the package phase, while
> >>>>> the add-features-to-repo was in the compile phase.
> >>>>>
> >>>>>
> >>>>> Does anybody know a standard or easy way to have the features.xml
> file
> >>>>> maven filtered in KARs ?
> >>>>>
> >>>>> Many Thanks
> >>>>>
> >>>>> Giacomo
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >
>
>
>

Re: Kar features.xml file is not filtered

Posted by Christoph Gritschenberger <ch...@gmail.com>.
And is the file actually not there?
Is it nowhere in the target-directory?

kind regards,
christoph

On 22/10/12 14:51, Giacomo Coletta wrote:
> hi,
> 
> this does not work for me.
> 
> The message i get is:
> 
> [ERROR] Failed to execute goal
> org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar
> (create-kar) on project kar.rttr: Could not interpret features XML file:
> C:\DEV3\Sources\RTTR\osgi.rttr.repo\karaf\kars\kar.rttr\target\classes\feature.xml
> (Impossible to find the specified path) :
> file:/C:/DEV3/Sources/RTTR/osgi.rttr.repo/karaf/kars/kar.rttr/target/classes/feature.xml
> -> [Help 1]
> 
> 2012/10/19 Michael Täschner <m....@gmail.com>
> 
>> Hi,
>>
>> pick up the filtered file from the target folder. Here's my example config:
>>
>>
>>       <plugin>
>>         <groupId>org.apache.karaf.tooling</groupId>
>>         <artifactId>features-maven-plugin</artifactId>
>>         <extensions>true</extensions>
>>
>>         <executions>
>>           <execution>
>>             <id>create-kar</id>
>>             <phase>process-resources</phase>
>>
>>             <goals>
>>               <goal>create-kar</goal>
>>             </goals>
>>             <configuration>
>>
>> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
>>               <includeDependencies>false</includeDependencies>
>>
>> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
>>             </configuration>
>>           </execution>
>>         </executions>
>>       </plugin>
>>
>> Regards,
>> Michael
>>
>> P.S.: I do not actually remember why I added the /doesNotExist folder
>> though but feature.xml is located in src/main/resourses
>>
>>
>> 2012/10/19 Giacomo Coletta <co...@gmail.com>
>>
>>> This was more or less what I already tried, but alone does not work.
>>>
>>> it seem that the resources:resources goal is not executed during
>>> packaging with  <packaging>pom</packaging> (while it is with jars).
>>>
>>> i tried a bit more and in the end find something working (even if doesn't
>>> look so clean):
>>>
>>>  <build>
>>>         <resources>
>>>             <resource>
>>>
>>> <directory>${project.basedir}/src/main/feature/</directory>
>>>                 <filtering>true</filtering>
>>>                 <includes>
>>>                     <include>**/*</include>
>>>                 </includes>
>>>
>>> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
>>>             </resource>
>>>         </resources>
>>>         <plugins>
>>>             <plugin>
>>>                 <groupId>org.apache.maven.plugins</groupId>
>>>                 <artifactId>maven-resources-plugin</artifactId>
>>>                 <version>${maven-resources-plugin.version}</version>
>>>                 <executions>
>>>                     <execution>
>>>                         <id>filter</id>
>>>                         <phase>generate-resources</phase>
>>>                         <goals>
>>>                             <goal>resources</goal>
>>>                         </goals>
>>>                     </execution>
>>>                 </executions>
>>>             </plugin>
>>>             <plugin>
>>>                 <groupId>org.apache.karaf.tooling</groupId>
>>>                 <artifactId>features-maven-plugin</artifactId>
>>>                 <version>2.2.9</version>
>>>                 <executions>
>>>                     <execution>
>>>                         <id>create-kar</id>
>>>                         <goals>
>>>                             <goal>create-kar</goal>
>>>                         </goals>
>>>                         <configuration>
>>>
>>>
>>> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
>>>                         </configuration>
>>>
>>>                     </execution>
>>>                 </executions>
>>>             </plugin>
>>>         </plugins>
>>>     </build>
>>>
>>> Thanks anyway.
>>>
>>> Giacomo
>>>
>>> 2012/10/19 Christoph Gritschenberger <christoph.gritschenberger@gmail.com
>>>>
>>>
>>>> You need to enable resource-filtering in your maven-build. You can set
>>>> this up in your pom.xml like this:
>>>>
>>>> ...
>>>>   <build>
>>>>     <resources>
>>>>       <resource>
>>>>
>>>> <directory>${project.basedir}/src/main/filtered-resources</directory>
>>>>         <filtering>true</filtering>
>>>>         <includes>
>>>>           <include>**/*</include>
>>>>         </includes>
>>>>       </resource>
>>>>     </resources>
>>>>     ...
>>>>   </build>
>>>> ...
>>>>
>>>> kind regards,
>>>> christoph
>>>>
>>>> On 19/10/12 11:16, Giacomo Coletta wrote:
>>>>> Hi,
>>>>>
>>>>> i started using the KARs archives, and creates a few KARS using the KAR
>>>>> archetype.
>>>>>
>>>>> one problem I encountered is that the features.xml file included in
>>>> the kar
>>>>> in the generated maven project doesn't seem to be maven filtered by
>>>> default.
>>>>> I would like it to be filtered for managing the included karaf
>>>> features and
>>>>> bundles versions using maven properties like in the following example:
>>>>>
>>>>> <features name="myfeatures-repo" version="${myfeatures-repo.version}">
>>>>>     <feature name="myfeature" version="${myfeature.version}">
>>>>>           <bundle>
>>>>> mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
>>>>>
>>>>>     </feature>
>>>>> </features>
>>>>>
>>>>> i was able to do this while including the features in an assembly
>>>> using the
>>>>> add-features-to-repo goal of the features-maven-plugin (features.xml
>>>> was
>>>>> filtered by default)
>>>>>
>>>>> I tried to do the same with kars, but I was not able to get to this
>>>> result
>>>>> quickly.
>>>>> May be this is related to the fact that in the features-maven-pluging
>>>> the
>>>>> create-kar goal is tied to the package phase, while
>>>>> the add-features-to-repo was in the compile phase.
>>>>>
>>>>>
>>>>> Does anybody know a standard or easy way to have the features.xml file
>>>>> maven filtered in KARs ?
>>>>>
>>>>> Many Thanks
>>>>>
>>>>> Giacomo
>>>>>
>>>>
>>>>
>>>>
>>>
>>
> 



Re: Kar features.xml file is not filtered

Posted by Giacomo Coletta <co...@gmail.com>.
hi,

this does not work for me.

The message i get is:

[ERROR] Failed to execute goal
org.apache.karaf.tooling:features-maven-plugin:2.3.0:create-kar
(create-kar) on project kar.rttr: Could not interpret features XML file:
C:\DEV3\Sources\RTTR\osgi.rttr.repo\karaf\kars\kar.rttr\target\classes\feature.xml
(Impossible to find the specified path) :
file:/C:/DEV3/Sources/RTTR/osgi.rttr.repo/karaf/kars/kar.rttr/target/classes/feature.xml
-> [Help 1]

2012/10/19 Michael Täschner <m....@gmail.com>

> Hi,
>
> pick up the filtered file from the target folder. Here's my example config:
>
>
>       <plugin>
>         <groupId>org.apache.karaf.tooling</groupId>
>         <artifactId>features-maven-plugin</artifactId>
>         <extensions>true</extensions>
>
>         <executions>
>           <execution>
>             <id>create-kar</id>
>             <phase>process-resources</phase>
>
>             <goals>
>               <goal>create-kar</goal>
>             </goals>
>             <configuration>
>
> <resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
>               <includeDependencies>false</includeDependencies>
>
> <featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
> Regards,
> Michael
>
> P.S.: I do not actually remember why I added the /doesNotExist folder
> though but feature.xml is located in src/main/resourses
>
>
> 2012/10/19 Giacomo Coletta <co...@gmail.com>
>
>> This was more or less what I already tried, but alone does not work.
>>
>> it seem that the resources:resources goal is not executed during
>> packaging with  <packaging>pom</packaging> (while it is with jars).
>>
>> i tried a bit more and in the end find something working (even if doesn't
>> look so clean):
>>
>>  <build>
>>         <resources>
>>             <resource>
>>
>> <directory>${project.basedir}/src/main/feature/</directory>
>>                 <filtering>true</filtering>
>>                 <includes>
>>                     <include>**/*</include>
>>                 </includes>
>>
>> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
>>             </resource>
>>         </resources>
>>         <plugins>
>>             <plugin>
>>                 <groupId>org.apache.maven.plugins</groupId>
>>                 <artifactId>maven-resources-plugin</artifactId>
>>                 <version>${maven-resources-plugin.version}</version>
>>                 <executions>
>>                     <execution>
>>                         <id>filter</id>
>>                         <phase>generate-resources</phase>
>>                         <goals>
>>                             <goal>resources</goal>
>>                         </goals>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>             <plugin>
>>                 <groupId>org.apache.karaf.tooling</groupId>
>>                 <artifactId>features-maven-plugin</artifactId>
>>                 <version>2.2.9</version>
>>                 <executions>
>>                     <execution>
>>                         <id>create-kar</id>
>>                         <goals>
>>                             <goal>create-kar</goal>
>>                         </goals>
>>                         <configuration>
>>
>>
>> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
>>                         </configuration>
>>
>>                     </execution>
>>                 </executions>
>>             </plugin>
>>         </plugins>
>>     </build>
>>
>> Thanks anyway.
>>
>> Giacomo
>>
>> 2012/10/19 Christoph Gritschenberger <christoph.gritschenberger@gmail.com
>> >
>>
>>> You need to enable resource-filtering in your maven-build. You can set
>>> this up in your pom.xml like this:
>>>
>>> ...
>>>   <build>
>>>     <resources>
>>>       <resource>
>>>
>>> <directory>${project.basedir}/src/main/filtered-resources</directory>
>>>         <filtering>true</filtering>
>>>         <includes>
>>>           <include>**/*</include>
>>>         </includes>
>>>       </resource>
>>>     </resources>
>>>     ...
>>>   </build>
>>> ...
>>>
>>> kind regards,
>>> christoph
>>>
>>> On 19/10/12 11:16, Giacomo Coletta wrote:
>>> > Hi,
>>> >
>>> > i started using the KARs archives, and creates a few KARS using the KAR
>>> > archetype.
>>> >
>>> > one problem I encountered is that the features.xml file included in
>>> the kar
>>> > in the generated maven project doesn't seem to be maven filtered by
>>> default.
>>> > I would like it to be filtered for managing the included karaf
>>> features and
>>> > bundles versions using maven properties like in the following example:
>>> >
>>> > <features name="myfeatures-repo" version="${myfeatures-repo.version}">
>>> >     <feature name="myfeature" version="${myfeature.version}">
>>> >           <bundle>
>>> > mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
>>> >
>>> >     </feature>
>>> > </features>
>>> >
>>> > i was able to do this while including the features in an assembly
>>> using the
>>> > add-features-to-repo goal of the features-maven-plugin (features.xml
>>> was
>>> > filtered by default)
>>> >
>>> > I tried to do the same with kars, but I was not able to get to this
>>> result
>>> > quickly.
>>> > May be this is related to the fact that in the features-maven-pluging
>>> the
>>> > create-kar goal is tied to the package phase, while
>>> > the add-features-to-repo was in the compile phase.
>>> >
>>> >
>>> > Does anybody know a standard or easy way to have the features.xml file
>>> > maven filtered in KARs ?
>>> >
>>> > Many Thanks
>>> >
>>> > Giacomo
>>> >
>>>
>>>
>>>
>>
>

Re: Kar features.xml file is not filtered

Posted by Michael Täschner <m....@gmail.com>.
Hi,

pick up the filtered file from the target folder. Here's my example config:

      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>create-kar</id>
            <phase>process-resources</phase>
            <goals>
              <goal>create-kar</goal>
            </goals>
            <configuration>

<resourcesDir>${project.build.directory}/doesNotExist</resourcesDir>
              <includeDependencies>false</includeDependencies>

<featuresFile>${project.build.outputDirectory}/feature.xml</featuresFile>
            </configuration>
          </execution>
        </executions>
      </plugin>

Regards,
Michael

P.S.: I do not actually remember why I added the /doesNotExist folder
though but feature.xml is located in src/main/resourses

2012/10/19 Giacomo Coletta <co...@gmail.com>

> This was more or less what I already tried, but alone does not work.
>
> it seem that the resources:resources goal is not executed during packaging
> with  <packaging>pom</packaging> (while it is with jars).
>
> i tried a bit more and in the end find something working (even if doesn't
> look so clean):
>
>  <build>
>         <resources>
>             <resource>
>                 <directory>${project.basedir}/src/main/feature/</directory>
>                 <filtering>true</filtering>
>                 <includes>
>                     <include>**/*</include>
>                 </includes>
>
> <targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
>             </resource>
>         </resources>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-resources-plugin</artifactId>
>                 <version>${maven-resources-plugin.version}</version>
>                 <executions>
>                     <execution>
>                         <id>filter</id>
>                         <phase>generate-resources</phase>
>                         <goals>
>                             <goal>resources</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.karaf.tooling</groupId>
>                 <artifactId>features-maven-plugin</artifactId>
>                 <version>2.2.9</version>
>                 <executions>
>                     <execution>
>                         <id>create-kar</id>
>                         <goals>
>                             <goal>create-kar</goal>
>                         </goals>
>                         <configuration>
>
>
> <featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
>                         </configuration>
>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
>     </build>
>
> Thanks anyway.
>
> Giacomo
>
> 2012/10/19 Christoph Gritschenberger <ch...@gmail.com>
>
>> You need to enable resource-filtering in your maven-build. You can set
>> this up in your pom.xml like this:
>>
>> ...
>>   <build>
>>     <resources>
>>       <resource>
>>
>> <directory>${project.basedir}/src/main/filtered-resources</directory>
>>         <filtering>true</filtering>
>>         <includes>
>>           <include>**/*</include>
>>         </includes>
>>       </resource>
>>     </resources>
>>     ...
>>   </build>
>> ...
>>
>> kind regards,
>> christoph
>>
>> On 19/10/12 11:16, Giacomo Coletta wrote:
>> > Hi,
>> >
>> > i started using the KARs archives, and creates a few KARS using the KAR
>> > archetype.
>> >
>> > one problem I encountered is that the features.xml file included in the
>> kar
>> > in the generated maven project doesn't seem to be maven filtered by
>> default.
>> > I would like it to be filtered for managing the included karaf features
>> and
>> > bundles versions using maven properties like in the following example:
>> >
>> > <features name="myfeatures-repo" version="${myfeatures-repo.version}">
>> >     <feature name="myfeature" version="${myfeature.version}">
>> >           <bundle>
>> > mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
>> >
>> >     </feature>
>> > </features>
>> >
>> > i was able to do this while including the features in an assembly using
>> the
>> > add-features-to-repo goal of the features-maven-plugin (features.xml was
>> > filtered by default)
>> >
>> > I tried to do the same with kars, but I was not able to get to this
>> result
>> > quickly.
>> > May be this is related to the fact that in the features-maven-pluging
>> the
>> > create-kar goal is tied to the package phase, while
>> > the add-features-to-repo was in the compile phase.
>> >
>> >
>> > Does anybody know a standard or easy way to have the features.xml file
>> > maven filtered in KARs ?
>> >
>> > Many Thanks
>> >
>> > Giacomo
>> >
>>
>>
>>
>

Re: Kar features.xml file is not filtered

Posted by Giacomo Coletta <co...@gmail.com>.
This was more or less what I already tried, but alone does not work.

it seem that the resources:resources goal is not executed during packaging
with  <packaging>pom</packaging> (while it is with jars).

i tried a bit more and in the end find something working (even if doesn't
look so clean):

 <build>
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/feature/</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>

<targetPath>${project.basedir}/src/main/filteredFeature/</targetPath>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>features-maven-plugin</artifactId>
                <version>2.2.9</version>
                <executions>
                    <execution>
                        <id>create-kar</id>
                        <goals>
                            <goal>create-kar</goal>
                        </goals>
                        <configuration>


<featuresFile>${project.basedir}/src/main/filteredFeature/feature.xml</featuresFile>
                        </configuration>

                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Thanks anyway.

Giacomo

2012/10/19 Christoph Gritschenberger <ch...@gmail.com>

> You need to enable resource-filtering in your maven-build. You can set
> this up in your pom.xml like this:
>
> ...
>   <build>
>     <resources>
>       <resource>
>
> <directory>${project.basedir}/src/main/filtered-resources</directory>
>         <filtering>true</filtering>
>         <includes>
>           <include>**/*</include>
>         </includes>
>       </resource>
>     </resources>
>     ...
>   </build>
> ...
>
> kind regards,
> christoph
>
> On 19/10/12 11:16, Giacomo Coletta wrote:
> > Hi,
> >
> > i started using the KARs archives, and creates a few KARS using the KAR
> > archetype.
> >
> > one problem I encountered is that the features.xml file included in the
> kar
> > in the generated maven project doesn't seem to be maven filtered by
> default.
> > I would like it to be filtered for managing the included karaf features
> and
> > bundles versions using maven properties like in the following example:
> >
> > <features name="myfeatures-repo" version="${myfeatures-repo.version}">
> >     <feature name="myfeature" version="${myfeature.version}">
> >           <bundle>
> > mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
> >
> >     </feature>
> > </features>
> >
> > i was able to do this while including the features in an assembly using
> the
> > add-features-to-repo goal of the features-maven-plugin (features.xml was
> > filtered by default)
> >
> > I tried to do the same with kars, but I was not able to get to this
> result
> > quickly.
> > May be this is related to the fact that in the features-maven-pluging the
> > create-kar goal is tied to the package phase, while
> > the add-features-to-repo was in the compile phase.
> >
> >
> > Does anybody know a standard or easy way to have the features.xml file
> > maven filtered in KARs ?
> >
> > Many Thanks
> >
> > Giacomo
> >
>
>
>

Re: Kar features.xml file is not filtered

Posted by Christoph Gritschenberger <ch...@gmail.com>.
You need to enable resource-filtering in your maven-build. You can set
this up in your pom.xml like this:

...
  <build>
    <resources>
      <resource>

<directory>${project.basedir}/src/main/filtered-resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
    </resources>
    ...
  </build>
...

kind regards,
christoph

On 19/10/12 11:16, Giacomo Coletta wrote:
> Hi,
> 
> i started using the KARs archives, and creates a few KARS using the KAR
> archetype.
> 
> one problem I encountered is that the features.xml file included in the kar
> in the generated maven project doesn't seem to be maven filtered by default.
> I would like it to be filtered for managing the included karaf features and
> bundles versions using maven properties like in the following example:
> 
> <features name="myfeatures-repo" version="${myfeatures-repo.version}">
>     <feature name="myfeature" version="${myfeature.version}">
>           <bundle>
> mvn:mybundle.groupId/mybundle.ArtifactId/${mybundle.version}</bundle>
> 
>     </feature>
> </features>
> 
> i was able to do this while including the features in an assembly using the
> add-features-to-repo goal of the features-maven-plugin (features.xml was
> filtered by default)
> 
> I tried to do the same with kars, but I was not able to get to this result
> quickly.
> May be this is related to the fact that in the features-maven-pluging the
> create-kar goal is tied to the package phase, while
> the add-features-to-repo was in the compile phase.
> 
> 
> Does anybody know a standard or easy way to have the features.xml file
> maven filtered in KARs ?
> 
> Many Thanks
> 
> Giacomo
>