diff --git a/src/it/war-resources/invoker.properties b/src/it/war-resources/invoker.properties new file mode 100644 index 00000000..c743aa4f --- /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 00000000..4dc93fdc --- /dev/null +++ b/src/it/war-resources/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + test + war-resources + 1.0-SNAPSHOT + war + Maven War Resources Project Test + maven test it + + + + + maven-war-plugin + @pom.version@ + + + + src/main/extra + / + false + + + + + + + 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 00000000..6d40bec2 --- /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. + --%> + + + +

Hello World from another!

+ + 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 00000000..36c5645f --- /dev/null +++ b/src/it/war-resources/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,26 @@ + + + + + + Archetype Created Web Application + 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 00000000..d9b080ed --- /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. + --%> + + + +

Hello World!

+ + diff --git a/src/it/war-resources/verify.groovy b/src/it/war-resources/verify.groovy new file mode 100644 index 00000000..8f507ebc --- /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 cb1a8de9..141f6a9e 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 @@ protected void copyFiles( */ // 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 b31076db..48dbbccb 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 void copyResources(WarPackagingContext context, Resource resource) 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); } } }