for sake of completeness, i also tried with maven-war-plugin version 2.0.1 .

here is the stacktrace:
[INFO] Failure

Embedded error: IOException parsing XML document from ServletContext
resource [/${dbms.filter}]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource [/${
dbms.filter}]

i also tried putting this:
dbms.filter = classpath*:/springapp-pgdb.xml

in the webxml-filter.xml (that is the filter definition file), without any
luck.


On 10/30/06, Valerio Schiavoni <[EMAIL PROTECTED]> wrote:

hello everyone,
i know this has been discussed recently (also here: 
http://www.nabble.com/War-plugin-and-filtering-webapp-files-t1617964.html
) , but thevarious  solutions and hacks proposed haven't solved my issue
:(

Consider this snippet of web.xml:
<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath*:/acegi.xml
            classpath*:/springapp-servlet.xml
            classpath*:/datasource-populator.xml
            ${dbms.filter}
        </param-value>
</context-param>

I'd like to change the value of the dbms.filter variable value depending
on a given profile.
So i have the following in my pom.xml:
//configuration for the maven-war-plugin
<build>
<filters>
            <filter>${basedir}/src/main/filters/webxml-filter.xml</filter>
        </filters>
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0</version>
        <configuration>
        <webResources>
              <resource>
                             <filtering>true</filtering>

<directory>${basedir}/src/main/webapp</directory>
                             <includes>
                                 <include>**/*.xml</include>
                             </includes>
                  </resource>
          </webResources>
                 </configuration>
</plugin>
</build>

then, a profile :

<profile>
            <id>postgres</id>
            <activation>
                <property>
                    <name>dbms</name>
                    <value>postgres</value>
                </property>
            </activation>
            <properties>
                <dbms.filter>classpath*:/springapp-pgdb.xml</dbms.filter>
            </properties>
        </profile>

so that when I issue : mvn clean -Ddbms=postgres i'm expecting the web.xmlfile 
to be filled with the value
specified in the postgres profile. which actually is not happening.
the <filter> element is there only because I read it fixes some current
issues, and it actually refers to an empty filter file.

any suggestion is very appreciated.
--
http://valerioschiavoni.blogspot.com
http://jroller.com/page/vschiavoni




--
http://valerioschiavoni.blogspot.com
http://jroller.com/page/vschiavoni

Reply via email to