karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Coletta <coletta.giac...@gmail.com>
Subject Re: Kar features.xml file is not filtered
Date Fri, 19 Oct 2012 13:23:27 GMT
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
> >
>
>
>

Mime
View raw message