You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kris Nuttycombe <Kr...@noaa.gov> on 2006/05/15 20:53:08 UTC

War plugin v2.0 filtering problems

Well, upon initial analysis, the webResources functionality is not 
behaving as I would expect. Here's my plugin config:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <filters>
                      
<filter>src/main/filters/${targetHost}.properties</filter>
                    </filters>
                    <webResources>
                        <webResource>
                            <filtering>true</filtering>
                            
<directory>${basedir}/src/main/webapp</directory>
                            <includes>
                                <include>**/*.xml</include>
                                <include>**/*.properties</include>
                            </includes>
                        </webResource>
                        <webResource>
                            <targetPath>WEB-INF</targetPath>
                            <directory>${basedir}/src/main/keys</directory>
                            <includes>
                                <include>.dbkey</include>
                            </includes>
                        </weResource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>

In this configuration, I specify -DtargetHost=hostname to get the filter 
I want to use for the package in question (this works fine for regular 
resources). No filtering appears to be occurring, and all of the 
resources (including the .dbkey resource) appear to be being copied to 
the root of the web application instead of their appropriate places in 
the directory structure or WEB-INF, respectively. I've also attempted 
pulling the resources to be filtered out of the src/main/webapp 
hierarchy, but
this appears to make no difference.

Any suggestions? Here's my original configuration (that works correctly):

    <build>
        <finalName>${artifactId}-${targetHost}-${version}</finalName>
        <filters>
          <filter>src/main/filters/${targetHost}.properties</filter>
        </filters>
        <resources>
            <resource>
                <targetPath>../filtered-webapp-resources</targetPath>
                <filtering>true</filtering>
                <directory>${basedir}/src/main/webapp</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <targetPath>../filtered-webapp-resources</targetPath>
                <filtering>false</filtering>
                <directory>${basedir}/src/main/webapp</directory>
                <excludes>
                    <exclude>**/*.xml</exclude>
                    <exclude>**/*.properties</exclude>
                </excludes>
            </resource>
            <resource>
                
<targetPath>../filtered-webapp-resources/WEB-INF</targetPath>
                <directory>${basedir}/src/main/keys</directory>
                <includes>
                    <include>.dbkey</include>
                </includes>
            </resource>
        </resources>
        ...
    </build>

Thanks,

Kris


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org