views:

31

answers:

1

Hi all,

I'm using maven to build a multimodule project.

In one project I execute maven-war-plugin four times in order to filter some properties in every execution. As a stand alone project it works well.

But when I build the multimodule, from the "parent" it executes four times, but none of them filter the properties.

Thank you all!

Heres a fragment of my pom.xml:

<project>  
<modelVersion>4.0.0</modelVersion>
<groupId>net.my</groupId>
<artifactId>my-project</artifactId>
<packaging>war</packaging>
<name>myProject</name>
<version>0.0.1</version>

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.0</version>
        <executions>
            <execution>
                <id>list</id>
                <phase>package</phase>
                <goals>
                    <goal>war</goal>
                </goals>
                <configuration>
                    <warName>myProj-list.war</warName>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <filtering>true</filtering>
                            <includes>
                                <include>**/*.xml</include>
                            </includes>
                        </resource>
                    </webResources>
                    <filtering>true</filtering>
                    <filters>
                        <filter>src/main/filters/list.properties</filter>
                    </filters>
                </configuration>
            </execution>  
            ...
            <!-- more executions -->
            </execution>
        </executions>
        <configuration>
            <webResources>
                <resource>
                    <directory>src/main/webapp</directory>
                    <filtering>true</filtering>
                    <includes>
                         <include>**/*.xml</include>
                      </includes>
                </resource>
             </webResources>
             <filters>
                <filter>src/main/filters/locator.properties</filter>
            </filters>
        </configuration>
    </plugin>
</plugins>
</build>
+1  A: 

But when I build the multimodule, from the "parent" it executes four times, but none of them filter the properties.

Sounds like a complicated setup... Anyway, are you sure the content of src/main/webapp does not override the filtered content? Running maven with -X might help to debug what is happening.

My suggestion would be to stop abusing abusing the webResources element (that should be used for External Web Resources) and to move the content that needs to be filtered outside src/main/webapp.

Pascal Thivent