[ 
https://issues.apache.org/jira/browse/KARAF-2742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14149121#comment-14149121
 ] 

Jean-Baptiste Onofré commented on KARAF-2742:
---------------------------------------------

Actually, it's already possible, you just have to execute the resources plugin 
just before the install-kar:

{code}
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
{code}

See your pom.xml updated:

{code}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apache.karaf.bugs</groupId>
    <artifactId>resource-filtering-bug</artifactId>
    <version>0.1-SNAPSHOT</version>
    <name>Demo project to reproduce resource filtering bug</name>

    <packaging>karaf-assembly</packaging>

    <properties>
        <karaf.version>3.0.2-SNAPSHOT</karaf.version>

        <mongo.db>database</mongo.db>
        <mongo.host>localhost</mongo.host>
        <mongo.user>user</mongo.user>
        <mongo.password>password</mongo.password>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>framework</artifactId>
            <version>${karaf.version}</version>
            <type>kar</type>
        </dependency>

        <dependency>
            <groupId>org.apache.karaf.features</groupId>
            <artifactId>standard</artifactId>
            <version>${karaf.version}</version>
            <type>xml</type>
            <classifier>features</classifier>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/filtered-resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>karaf-maven-plugin</artifactId>
                <version>${karaf.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <!-- no startupFeatures -->
                    <bootFeatures>
                        <feature>standard</feature>
                        <feature>management</feature>
                    </bootFeatures>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e 
settings only. It has no 
                    influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        
<groupId>org.apache.karaf.tooling</groupId>
                                        
<artifactId>karaf-maven-plugin</artifactId>
                                        <versionRange>[3.0.0,)</versionRange>
                                        <goals>
                                            <goal>install-kars</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
{code}

> karaf-maven-plugin can not include filtered resources in a custom distribution
> ------------------------------------------------------------------------------
>
>                 Key: KARAF-2742
>                 URL: https://issues.apache.org/jira/browse/KARAF-2742
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-tooling
>    Affects Versions: 3.0.0
>         Environment: Fedora 20, Oracle JDK 1.7.0_51, Maven 3.0.4
>            Reporter: Partha Roy
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 4.0.0, 3.0.2
>
>         Attachments: karaf-filtering-bug.tar.gz
>
>
> I am trying to build a custom Karaf distribution by following 
> http://karaf.apache.org/manual/latest/developers-guide/custom-distribution.html.
>  I need to add a .cfg file in the karaf/etc directory. However, the maven 
> resource filtering on that .cfg file does not work.
> The sample project looks like:
> {code}
> karaf-filtering-bug
> ├── pom.xml
> ├── readme.txt
> └── src
>     └── main
>         └── filtered-resources
>             └── etc
>                 └── filtering.bug.cfg
> {code}
> The filtering.bug.cfg file should be filtered with maven resource plugin. I 
> am expecting that the filtered file will get included in the karaf 
> distribution. I can see that target/classes/etc/filtering.bug.cfg actually 
> has the correct content but the karaf/etc/filtering.bug.cfg still has the 
> maven variables.
> I'll upload the sample project as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to