Author: khmarbaise Date: Tue Jun 10 08:01:48 2014 New Revision: 1601568 URL: http://svn.apache.org/r1601568 Log: [MWAR-311] - Fixed problem with project filtering verified by integration test by Evan Brodie.
Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/pom.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/app.properties maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/default.properties maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/web.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/verify.groovy Modified: maven/plugins/trunk/maven-war-plugin/pom.xml maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Modified: maven/plugins/trunk/maven-war-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/pom.xml?rev=1601568&r1=1601567&r2=1601568&view=diff ============================================================================== --- maven/plugins/trunk/maven-war-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-war-plugin/pom.xml Tue Jun 10 08:01:48 2014 @@ -250,48 +250,45 @@ under the License. <profile> <id>run-its</id> <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-invoker-plugin</artifactId> - <configuration> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <configuration> + <goals> + <goal>clean</goal> + <goal>package</goal> + </goals> + <projectsDirectory>src/it</projectsDirectory> + <postBuildHookScript>verify</postBuildHookScript> + <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> + <settingsFile>src/it/settings.xml</settingsFile> + <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + </configuration> + <executions> + <execution> + <id>install</id> + <phase>pre-integration-tests</phase> <goals> - <goal>clean</goal> - <goal>package</goal> + <goal>install</goal> </goals> - <projectsDirectory>src/it</projectsDirectory> - <postBuildHookScript>verify</postBuildHookScript> - <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> - <settingsFile>src/it/settings.xml</settingsFile> - <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> - </configuration> - <executions> - <execution> - <id>install</id> - <phase>pre-integration-test</phase> - <goals> - <goal>install</goal> - </goals> - <configuration> - <extraArtifacts> - <extraArtifact>javax.servlet:servlet-api:2.4:jar</extraArtifact> - <extraArtifact>org.apache.struts:struts-core:1.3.9:jar</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.4.7:jar:sources</extraArtifact> - </extraArtifacts> - </configuration> - </execution> - <execution> - <id>go</id> - <phase>integration-test</phase> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> + <configuration> + <extraArtifacts> + <extraArtifact>javax.servlet:servlet-api:2.4:jar</extraArtifact> + <extraArtifact>org.apache.struts:struts-core:1.3.9:jar</extraArtifact> + <extraArtifact>org.codehaus.plexus:plexus-utils:1.4.7:jar:sources</extraArtifact> + </extraArtifacts> + </configuration> + </execution> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> </profile> </profiles> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/pom.xml?rev=1601568&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/pom.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/pom.xml Tue Jun 10 08:01:48 2014 @@ -0,0 +1,64 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.ecbrodie</groupId> + <artifactId>MWAR-311</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>Maven War Plugin Bug</name> + <description>Filtering of properties files (as a web resource) broken in maven-war-plugin version 2.4.</description> + <packaging>war</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <my.maven.property>foo foo</my.maven.property> + </properties> + + <build> + <filters> + <filter>src/main/resources/default.properties</filter> + </filters> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>@project.artifactId@</artifactId> + <version>@project.version@</version> + <configuration> + <webResources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <includes> + <include>**/app.properties</include> + </includes> + </resource> + </webResources> + <archiveClasses>true</archiveClasses> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/app.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/app.properties?rev=1601568&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/app.properties (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/app.properties Tue Jun 10 08:01:48 2014 @@ -0,0 +1,3 @@ +my.maven.property=${my.maven.property} +prop.a=${prop.a} +prop.b=${prop.b} Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/default.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/default.properties?rev=1601568&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/default.properties (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/resources/default.properties Tue Jun 10 08:01:48 2014 @@ -0,0 +1,2 @@ +prop.a=AAA +prop.b=BBB Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/web.xml?rev=1601568&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/web.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/src/main/webapp/WEB-INF/web.xml Tue Jun 10 08:01:48 2014 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> +</web-app> \ No newline at end of file Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/verify.groovy?rev=1601568&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/verify.groovy (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-311/verify.groovy Tue Jun 10 08:01:48 2014 @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def propertiesFile = new File(basedir, 'target/MWAR-311-0.0.1-SNAPSHOT/app.properties'); +assert propertiesFile.exists() + +assert propertiesFile.text.contains('my.maven.property=foo foo'); +assert propertiesFile.text.contains('prop.a=AAA'); +assert propertiesFile.text.contains('prop.b=BBB'); Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java?rev=1601568&r1=1601567&r2=1601568&view=diff ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java (original) +++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/AbstractWarMojo.java Tue Jun 10 08:01:48 2014 @@ -474,6 +474,9 @@ public abstract class AbstractWarMojo mavenResourcesExecution.setEscapeString( escapeString ); mavenResourcesExecution.setSupportMultiLineFiltering( supportMultiLineFiltering ); mavenResourcesExecution.setMavenProject( project ); + if (filters == null) { + filters = getProject().getBuild().getFilters(); + } mavenResourcesExecution.setFilters( filters ); mavenResourcesExecution.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath ); mavenResourcesExecution.setMavenSession( this.session );