Hi to all,

I need to filter the web.xml in some webapp :

I tried with :

  <build>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- Safety -->
                <mkdir dir="${project.build.directory}" />

                <tstamp>
                  <format property="last.updated" pattern="yyyy-MM-dd
hh:mm:ss" />
                </tstamp>
<echo 
file="${basedir}/target/filter.properties">build.time=${last.updated}${line.separator}os.infos=${os.name}
${os.version}${line.separator}user.infos=${user.name}${line.separator}java.infos=JDK
${java.vendor} ${java.runtime.version}${line.separator}</echo>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <archiveClasses>true</archiveClasses>
          <filters>
            <filter>${basedir}/target/filter.properties</filter>
          </filters>
          <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>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
      </plugin>

    </plugins>

  </build>


I found the right stuff in the target/filter.properties :

build.time=2008-07-02 11:23:43
os.infos=Windows XP 5.1
user.infos=hgomez
java.infos=JDK Sun Microsystems Inc. 1.5.0_15-b04

My web.xml is :

        <!-- last modification date of the current file -->
        <context-param>
                <param-name>date</param-name>
                <param-value>${build.time}</param-value>
        </context-param>

        <context-param>
                <param-name>WEBAPP.VERSION</param-name>
                <param-value>${project.version}</param-value>
        </context-param>
        <context-param>
                <param-name>WEBAPP.CANOPEE</param-name>
                <param-value>${project.parent.name} 
v${project.parent.version}</param-value>
        </context-param>
        <context-param>
                <param-name>WEBAPP.CREATION</param-name>
                <param-value>built by ${user.infos} on ${os.infos} with
${java.infos}</param-value>
        </context-param>


After mvn package ${build.time}, ${user.infos}, ${os.infos} and
${java.infos} and not filtered.

${project.version} and ${project.parent.name}
v${project.parent.version} are filtered.

What could be wrong ?

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to