diff --git a/src/main/java/org/apache/maven/plugins/war/WarMojo.java b/src/main/java/org/apache/maven/plugins/war/WarMojo.java index 861a10b..6b46c18 100644 --- a/src/main/java/org/apache/maven/plugins/war/WarMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/WarMojo.java @@ -82,7 +82,7 @@ public class WarMojo extends AbstractWarMojo { * * @since 2.1-alpha-2 */ - @Parameter + @Parameter(property = "maven.war.packagingExcludes") private String packagingExcludes; /** diff --git a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java index 8577299..d85a4c7 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java @@ -131,6 +131,43 @@ public void testSimpleWarPackagingExcludeWithIncludesRegEx() throws Exception { new String[] {"org/web/app/last-exile.jsp"}); } + public void testSimpleWarPackagingExcludesWithRegEx() throws Exception { + String testId = "SimpleWarPackagingExcludesWithRegEx"; + MavenProject4CopyConstructor project = new MavenProject4CopyConstructor(); + String outputDir = getTestDirectory().getAbsolutePath() + "/" + testId + "-output"; + File webAppDirectory = new File(getTestDirectory(), testId); + WarArtifact4CCStub warArtifact = new WarArtifact4CCStub(getBasedir()); + String warName = "simple"; + File webAppSource = createWebAppSource(testId); + File classesDir = createClassesDir(testId, true); + File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); + + project.setArtifact(warArtifact); + this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + setVariableValueToObject(mojo, "outputDirectory", outputDir); + setVariableValueToObject(mojo, "warName", warName); + mojo.setWebXml(new File(xmlSource, "web.xml")); + setVariableValueToObject(mojo, "packagingExcludes", "%regex[.+/last-exile.+]"); + + mojo.execute(); + + // validate jar file + File expectedJarFile = new File(outputDir, "simple.war"); + assertJarContent( + expectedJarFile, + new String[] { + "META-INF/MANIFEST.MF", + "WEB-INF/web.xml", + "pansit.jsp", + "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.xml", + "META-INF/maven/org.apache.maven.plugin.test/maven-war-plugin-test/pom.properties" + }, + new String[] { + null, mojo.getWebXml().toString(), null, null, null, + }, + new String[] {"org/web/app/last-exile.jsp"}); + } + public void testClassifier() throws Exception { String testId = "Classifier"; MavenProject4CopyConstructor project = new MavenProject4CopyConstructor();