Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/it/war-resources/invoker.properties
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions src/it/war-resources/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
24 changes: 24 additions & 0 deletions src/it/war-resources/src/main/extra/another.jsp
Original file line number Diff line number Diff line change
@@ -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>
26 changes: 26 additions & 0 deletions src/it/war-resources/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -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>
24 changes: 24 additions & 0 deletions src/it/war-resources/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -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>
23 changes: 23 additions & 0 deletions src/it/war-resources/verify.groovy
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down