You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Julien Martin <ba...@gmail.com> on 2009/01/19 17:01:59 UTC

[Beginner needs help] Populating a web.xml context-param from a maven variable?

Hello,
I would like to achieve the following:
-retrieve the <version>  from a properties file so that I can include it in
both the POM and my web.xml (context parameter). Is that possible? How
can I achieve this?
Thanks,
Julien.

Re: [Beginner needs help] Populating a web.xml context-param from a maven variable?

Posted by Julien Martin <ba...@gmail.com>.
Easy:
I added the following plugin:
 <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>

and then the following context-param:
<context-param>
        <param-name>com.mycompany.version</param-name>
        <param-value>${pom.version}</param-value>
    </context-param>
That did the trick!
Thanks maven,
Julien.