Hi,

Just to build on this a bit, the maven plugin definitely supports the
filtering of resources (outside of WEB-INF/classes).  Here is a full <build>
config which filters web.xml (*.xml, actually) and places it in the WEB-INF
directory:


    <build>
        <plugins>
            <!-- the below filters src/.../WEB-INF resources and places the
filtered files in WEB-INF of our target war -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webResources>
                        <webResource>
                           
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
                            <includes>
                                <include>*.xml</include>
                            </includes>
                            <targetPath>WEB-INF</targetPath>
                            <filtering>true</filtering>
                        </webResource>
                    </webResources>
                </configuration>
            </plugin>
        </plugins>

        <filters>
            <filter>src/main/filters/filter-${env}.properties</filter>
        </filters>

        <!-- the below filters general resources and places the filtered
files in WEB-INF/classes of our target war --> 
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <!--
            <resource>
                <directory>src/main/webapp/WEB-INF</directory>
                <filtering>true</filtering>
            </resource>
            -->
        </resources>
    </build>

Todd Fulton


Tim Kettler wrote:
> 
> Hi,
> 
> I do it like this:
> 
>    <build>
>      <plugins>
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-war-plugin</artifactId>
>          <configuration>
>            <webResources>
>              <webResource>
>                <directory>${basedir}/src/main/webapp/WEB-INF</directory>
>                <includes>
>                  <include>web.xml</include>
>                </includes>
>                <targetPath>WEB-INF</targetPath>
>                <filtering>true</filtering>
>              </webResource>
>            </webResources>
>          </configuration>
>        </plugin>
>      </plugins>
>    </build>
> 
> and I think this is the right way to do it since standard resources end 
> up somewhere under 'target/classes' and I don't want that polluted with 
> a web.xml file.
> 
> -Tim
> 
> Henri Gomez schrieb:
>> Hi to all,
>> 
>> In a war project I'd like to filter the src/main/webapp/WEB-INF/web.xml :
>> 
>> ie : update the display name to include the pom version
>> 
>>      <display-name>My Site Application v${pom.version}</display-name>
>> 
>> I read some threads and it's not clear if it should be done by
>> web-resources or standard filtering.
>> 
>> ie :
>> http://www.nabble.com/War-plugin-and-filtering-webapp-files-to4384723.html
>> 
>> 
>> Advice welcome, I'm using maven-war-plugin 2.0.2
>> 
>> regards and thanks for your help, I'm being crasy :)
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/filtering-web.xml-tp17263714p23410000.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to