This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 364679a bugfix: regression due to targetPath interfering with the
exclusion logic
364679a is described below
commit 364679a49c61768a39cc58f14516984768a88cb8
Author: lprimak <[email protected]>
AuthorDate: Fri Nov 14 10:52:55 2025 -0600
bugfix: regression due to targetPath interfering with the exclusion logic
---
src/it/war-resources/invoker.properties | 18 +++++++++
src/it/war-resources/pom.xml | 46 ++++++++++++++++++++++
src/it/war-resources/src/main/extra/another.jsp | 24 +++++++++++
.../war-resources/src/main/webapp/WEB-INF/web.xml | 26 ++++++++++++
src/it/war-resources/src/main/webapp/index.jsp | 24 +++++++++++
src/it/war-resources/verify.groovy | 23 +++++++++++
.../war/packaging/AbstractWarPackagingTask.java | 15 ++++++-
.../war/packaging/WarProjectPackagingTask.java | 2 +-
8 files changed, 176 insertions(+), 2 deletions(-)
diff --git a/src/it/war-resources/invoker.properties
b/src/it/war-resources/invoker.properties
new file mode 100644
index 0000000..c743aa4
--- /dev/null
+++ b/src/it/war-resources/invoker.properties
@@ -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.
+
+invoker.goals=clean package
diff --git a/src/it/war-resources/pom.xml b/src/it/war-resources/pom.xml
new file mode 100644
index 0000000..4dc93fd
--- /dev/null
+++ b/src/it/war-resources/pom.xml
@@ -0,0 +1,46 @@
+<!--
+ 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>test</groupId>
+ <artifactId>war-resources</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>Maven War Resources Project Test</name>
+ <description>maven test it</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>@pom.version@</version>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>src/main/extra</directory>
+ <targetPath>/</targetPath>
+ <filtering>false</filtering>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/war-resources/src/main/extra/another.jsp
b/src/it/war-resources/src/main/extra/another.jsp
new file mode 100644
index 0000000..6d40bec
--- /dev/null
+++ b/src/it/war-resources/src/main/extra/another.jsp
@@ -0,0 +1,24 @@
+<%--
+ ~ 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 from another!</h2>
+</body>
+</html>
diff --git a/src/it/war-resources/src/main/webapp/WEB-INF/web.xml
b/src/it/war-resources/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..36c5645
--- /dev/null
+++ b/src/it/war-resources/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,26 @@
+<?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.
+-->
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+ <display-name>Archetype Created Web Application</display-name>
+</web-app>
diff --git a/src/it/war-resources/src/main/webapp/index.jsp
b/src/it/war-resources/src/main/webapp/index.jsp
new file mode 100644
index 0000000..d9b080e
--- /dev/null
+++ b/src/it/war-resources/src/main/webapp/index.jsp
@@ -0,0 +1,24 @@
+<%--
+ ~ 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/war-resources/verify.groovy
b/src/it/war-resources/verify.groovy
new file mode 100644
index 0000000..8f507eb
--- /dev/null
+++ b/src/it/war-resources/verify.groovy
@@ -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.
+ */
+
+def warFile = new java.util.jar.JarFile( new
File(basedir,"target/war-resources-1.0-SNAPSHOT.war"), false)
+assert warFile.getEntry('WEB-INF/web.xml') != null
+assert warFile.getEntry('index.jsp') != null
+assert warFile.getEntry('another.jsp') != null
diff --git
a/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
b/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
index cb1a8de..141f6a9 100644
---
a/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
+++
b/src/main/java/org/apache/maven/plugins/war/packaging/AbstractWarPackagingTask.java
@@ -148,10 +148,23 @@ public abstract class AbstractWarPackagingTask implements
WarPackagingTask {
*/
// CHECKSTYLE_OFF: LineLength
protected void copyFile(String sourceId, final WarPackagingContext
context, final File file, String targetFilename)
+ throws IOException {
+ copyFile(sourceId, context, file, targetFilename, targetFilename);
+ }
+
+ /**
+ * Adds originalFilename for exclusion checks.
+ */
+ void copyFile(
+ String sourceId,
+ final WarPackagingContext context,
+ final File file,
+ String targetFilename,
+ String originalFilename)
throws IOException
// CHECKSTYLE_ON: LineLength
{
- if (isExcluded(targetFilename, context.getPackagingIncludes(),
context.getPackagingExcludes())) {
+ if (isExcluded(originalFilename, context.getPackagingIncludes(),
context.getPackagingExcludes())) {
context.getLog().debug("Skipping excluded file: " +
targetFilename);
return;
}
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 b31076d..48dbbcc 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
@@ -306,7 +306,7 @@ public class WarProjectPackagingTask extends
AbstractWarPackagingTask {
if (resource.isFiltering() &&
!context.isNonFilteredExtension(fileName)) {
copyFilteredFile(id, context, new
File(resource.getDirectory(), fileName), targetFileName);
} else {
- copyFile(id, context, new File(resource.getDirectory(),
fileName), targetFileName);
+ copyFile(id, context, new File(resource.getDirectory(),
fileName), targetFileName, fileName);
}
}
}