[MWAR-404] <filteringDeploymentDescriptors>true</> is not honored
 o Added IT to prove wrong behaviour and fixed the issues.


git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1792380 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/it/MWAR-404/pom.xml b/src/it/MWAR-404/pom.xml
new file mode 100644
index 0000000..339edda
--- /dev/null
+++ b/src/it/MWAR-404/pom.xml
@@ -0,0 +1,52 @@
+<?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/maven-v4_0_0.xsd">

+  <modelVersion>4.0.0</modelVersion>

+  <groupId>org.apache.maven.its.war</groupId>

+  <artifactId>maven-it-mwar404</artifactId>

+  <version>1.0</version>

+  <packaging>war</packaging>

+  <properties>

+    <foo>4.1.1</foo>

+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+  </properties>

+  <dependencies>

+    <dependency>

+      <groupId>junit</groupId>

+      <artifactId>junit</artifactId>

+      <version>3.8.1</version>

+      <scope>test</scope>

+    </dependency>

+  </dependencies>

+  <build>

+    <plugins>

+      <plugin>

+        <artifactId>maven-war-plugin</artifactId>

+        <version>@project.version@</version>

+        <configuration>

+          <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>

+        </configuration>

+      </plugin>

+    </plugins>

+  </build>

+</project>

diff --git a/src/it/MWAR-404/src/main/java/org/apache/mwar404/Foo.java b/src/it/MWAR-404/src/main/java/org/apache/mwar404/Foo.java
new file mode 100644
index 0000000..ebbc084
--- /dev/null
+++ b/src/it/MWAR-404/src/main/java/org/apache/mwar404/Foo.java
@@ -0,0 +1,24 @@
+package org.apache.mwar404;

+

+/*

+ * 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.

+ */

+

+public class Foo {

+

+}

diff --git a/src/it/MWAR-404/src/main/webapp/WEB-INF/geronimo-web.xml b/src/it/MWAR-404/src/main/webapp/WEB-INF/geronimo-web.xml
new file mode 100644
index 0000000..c96a534
--- /dev/null
+++ b/src/it/MWAR-404/src/main/webapp/WEB-INF/geronimo-web.xml
@@ -0,0 +1,49 @@
+<?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.
+-->
+<!--  This is the Geronimo Web application deployment descriptor.
+      Notice that the reference look up name declared in the web.xml is
+      mapped here to the JNDI name of the connection factory specified in
+      geronimo-ra.xml.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
+         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+         xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
+         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+	<environment>
+		<moduleId>
+			<groupId>com.scort.dm</groupId>
+			<artifactId>vscicsWebapp</artifactId>
+			<version>${foo}</version>
+			<type>war</type>
+		</moduleId>
+		<dependencies>
+			<dependency>
+				<groupId>org.apache.geronimo.configs</groupId>
+				<artifactId>sharedlib</artifactId>
+			</dependency>
+		</dependencies>
+		<inverse-classloading />
+	</environment>
+	<resource-ref>
+		<ref-name>demos/datamapper/cics/connectionFactory</ref-name>
+		<resource-link>cicsConnectionFactory</resource-link>
+	</resource-ref>
+
+ </web-app>
diff --git a/src/it/MWAR-404/src/main/webapp/WEB-INF/web.xml b/src/it/MWAR-404/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..aad4049
--- /dev/null
+++ b/src/it/MWAR-404/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+<!DOCTYPE web-app PUBLIC

+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

+ "http://java.sun.com/dtd/web-app_2_3.dtd" >

+<!--

+  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.

+-->

+<web-app>

+  <display-name>Archetype Created Web Application</display-name>

+</web-app>

diff --git a/src/it/MWAR-404/src/main/webapp/index.jsp b/src/it/MWAR-404/src/main/webapp/index.jsp
new file mode 100644
index 0000000..6b26cc2
--- /dev/null
+++ b/src/it/MWAR-404/src/main/webapp/index.jsp
@@ -0,0 +1,23 @@
+<!--

+  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.

+-->

+<html>

+<body>

+<h2>Hello World!</h2>

+</body>

+</html>

diff --git a/src/it/MWAR-404/src/main/webapp/jsp/foo.jsp b/src/it/MWAR-404/src/main/webapp/jsp/foo.jsp
new file mode 100644
index 0000000..300bfb4
--- /dev/null
+++ b/src/it/MWAR-404/src/main/webapp/jsp/foo.jsp
@@ -0,0 +1,18 @@
+<!--
+  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.
+-->
diff --git a/src/it/MWAR-404/verify.groovy b/src/it/MWAR-404/verify.groovy
new file mode 100644
index 0000000..400e852
--- /dev/null
+++ b/src/it/MWAR-404/verify.groovy
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.FileUtils;
+
+try
+{
+    File file = new File( basedir, "target/maven-it-mwar404-1.0/WEB-INF/geronimo-web.xml" );
+    String buf = FileUtils.fileRead( file, "UTF-8" );
+
+    if ( buf.indexOf( "<version>4.1.1</version>" ) < 0 )
+    {
+        System.err.println( "property has not been replaced in geronimo-web.xml" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
index 7e0b03e..243c715 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
@@ -170,13 +170,14 @@
         else if ( !context.getWebappSourceDirectory().getAbsolutePath().equals( context.getWebappDirectory().getPath() ) )
         {
             context.getLog().info( "Copying webapp resources [" + context.getWebappSourceDirectory() + "]" );
+            context.getLog().debug( "isFilteringDeploymentDescriptors: [" + context.isFilteringDeploymentDescriptors() + "]" );
             final PathSet sources =
                 getFilesToIncludes( context.getWebappSourceDirectory(), context.getWebappSourceIncludes(),
                                     context.getWebappSourceExcludes(), context.isWebappSourceIncludeEmptyDirectories() );
 
             try
             {
-                copyFiles( id, context, context.getWebappSourceDirectory(), sources, false );
+                 copyFiles( id, context, context.getWebappSourceDirectory(), sources, context.isFilteringDeploymentDescriptors() );
             }
             catch ( IOException e )
             {