diff --git a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java index 0e6fde38..709e2e77 100644 --- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java @@ -278,12 +278,6 @@ public abstract class AbstractWarMojo extends AbstractMojo { @Parameter private List nonFilteredFileExtensions; - /** - * @since 2.1-alpha-2 - */ - @Parameter(defaultValue = "${session}", readonly = true, required = true) - private MavenSession session; - /** * To filter deployment descriptors. Disabled by default. * @@ -379,15 +373,19 @@ public abstract class AbstractWarMojo extends AbstractMojo { private final MavenResourcesFiltering mavenResourcesFiltering; + private final MavenSession session; + protected AbstractWarMojo( ArtifactHandlerManager artifactHandlerManager, ArchiverManager archiverManager, MavenFileFilter mavenFileFilter, - MavenResourcesFiltering mavenResourcesFiltering) { + MavenResourcesFiltering mavenResourcesFiltering, + MavenSession session) { this.artifactHandlerManager = artifactHandlerManager; this.archiverManager = archiverManager; this.mavenFileFilter = mavenFileFilter; this.mavenResourcesFiltering = mavenResourcesFiltering; + this.session = session; try { this.jarArchiver = (JarArchiver) archiverManager.getArchiver("jar"); } catch (NoSuchArchiverException e) { diff --git a/src/main/java/org/apache/maven/plugins/war/WarExplodedMojo.java b/src/main/java/org/apache/maven/plugins/war/WarExplodedMojo.java index 3c3ecb90..66efb37c 100644 --- a/src/main/java/org/apache/maven/plugins/war/WarExplodedMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/WarExplodedMojo.java @@ -21,6 +21,7 @@ import javax.inject.Inject; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -44,8 +45,9 @@ public WarExplodedMojo( ArtifactHandlerManager artifactHandlerManager, ArchiverManager archiverManager, MavenFileFilter mavenFileFilter, - MavenResourcesFiltering mavenResourcesFiltering) { - super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering); + MavenResourcesFiltering mavenResourcesFiltering, + MavenSession session) { + super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering, session); } @Override diff --git a/src/main/java/org/apache/maven/plugins/war/WarInPlaceMojo.java b/src/main/java/org/apache/maven/plugins/war/WarInPlaceMojo.java index b5bf5120..bdf3e608 100644 --- a/src/main/java/org/apache/maven/plugins/war/WarInPlaceMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/WarInPlaceMojo.java @@ -21,6 +21,7 @@ import javax.inject.Inject; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @@ -40,8 +41,9 @@ public WarInPlaceMojo( ArtifactHandlerManager artifactHandlerManager, ArchiverManager archiverManager, MavenFileFilter mavenFileFilter, - MavenResourcesFiltering mavenResourcesFiltering) { - super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering); + MavenResourcesFiltering mavenResourcesFiltering, + MavenSession session) { + super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering, session); } @Override 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 c4efc27a..c68aac3c 100644 --- a/src/main/java/org/apache/maven/plugins/war/WarMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/WarMojo.java @@ -32,6 +32,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; +import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -136,8 +137,9 @@ public WarMojo( ArchiverManager archiverManager, MavenFileFilter mavenFileFilter, MavenResourcesFiltering mavenResourcesFiltering, - MavenProjectHelper projectHelper) { - super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering); + MavenProjectHelper projectHelper, + MavenSession session) { + super(artifactHandlerManager, archiverManager, mavenFileFilter, mavenResourcesFiltering, session); this.projectHelper = projectHelper; } diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java index f1bd3536..058cdda4 100644 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.LinkedList; import java.util.List; import org.apache.maven.plugin.testing.stubs.ArtifactStub; @@ -94,7 +93,7 @@ protected File setUpMojo(final String testId, ArtifactStub[] artifactStubs, Stri } } - configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "workDirectory", workDirectory); return webAppDirectory; diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java index 21135b42..217e754c 100644 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; import java.util.Date; -import java.util.List; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; @@ -30,7 +29,6 @@ import org.apache.maven.plugin.testing.stubs.ArtifactStub; import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; import org.apache.maven.plugins.war.stub.WarOverlayStub; -import org.apache.maven.shared.filtering.MavenFileFilter; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.jar.JarArchiver; @@ -47,11 +45,21 @@ public abstract class AbstractWarMojoTest extends AbstractMojoTestCase { protected abstract File getTestDirectory() throws Exception; + protected void setUp() throws Exception { + super.setUp(); + + MavenExecutionRequest request = new DefaultMavenExecutionRequest() + .setSystemProperties(System.getProperties()) + .setStartTime(new Date()); + + MavenSession mavenSession = + new MavenSession((PlexusContainer) null, (RepositorySystemSession) null, request, null); + getContainer().addComponent(mavenSession, MavenSession.class.getName()); + } /** * initialize required parameters * * @param mojo The mojo to be tested. - * @param filters The list of filters. * @param classesDir The classes' directory. * @param webAppSource The webAppSource. * @param webAppDir The webAppDir folder. @@ -59,23 +67,8 @@ public abstract class AbstractWarMojoTest extends AbstractMojoTestCase { * @throws Exception in case of errors */ protected void configureMojo( - AbstractWarMojo mojo, - List filters, - File classesDir, - File webAppSource, - File webAppDir, - MavenProjectBasicStub project) + AbstractWarMojo mojo, File classesDir, File webAppSource, File webAppDir, MavenProjectBasicStub project) throws Exception { - setVariableValueToObject(mojo, "filters", filters); - setVariableValueToObject(mojo, "mavenFileFilter", lookup(MavenFileFilter.class.getName())); - - MavenExecutionRequest request = new DefaultMavenExecutionRequest() - .setSystemProperties(System.getProperties()) - .setStartTime(new Date()); - - MavenSession mavenSession = - new MavenSession((PlexusContainer) null, (RepositorySystemSession) null, request, null); - setVariableValueToObject(mojo, "session", mavenSession); setVariableValueToObject(mojo, "outdatedCheckPath", "WEB-INF/lib/"); mojo.setClassesDirectory(classesDir); mojo.setWarSourceDirectory(webAppSource); diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java index 9d4aff65..03aa26f7 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java @@ -43,6 +43,7 @@ import java.util.LinkedList; import java.util.List; +import org.apache.maven.execution.MavenSession; import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; import org.apache.maven.plugins.war.stub.ResourceStub; import org.codehaus.plexus.util.FileUtils; @@ -96,14 +97,16 @@ public void testExplodedWarWithResourceFiltering() throws Exception { FileUtils.fileWrite(sampleResourceWDir.getAbsolutePath(), content); FileUtils.fileWrite(sampleResource.getAbsolutePath(), content); - System.setProperty("system.property", "system-property-value"); + lookup(MavenSession.class).getSystemProperties().setProperty("system.property", "system-property-value"); // configure mojo project.addProperty("is_this_simple", "i_think_so"); resources[0].setDirectory(webAppResource.getAbsolutePath()); resources[0].setFiltering(true); - this.configureMojo(mojo, filterList, classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "webResources", resources); + setVariableValueToObject(mojo, "filters", filterList); + mojo.execute(); // validate operation @@ -151,8 +154,8 @@ public void testExplodedWarWithResourceFiltering() throws Exception { reader.readLine()); // update property, and generate again - System.setProperty("system.property", "new-system-property-value"); - this.configureMojo(mojo, filterList, classesDir, webAppSource, webAppDirectory, project); + lookup(MavenSession.class).getSystemProperties().setProperty("system.property", "new-system-property-value"); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java index 33706e26..1fb2b047 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java @@ -20,7 +20,6 @@ import java.io.File; import java.text.SimpleDateFormat; -import java.util.LinkedList; import java.util.Locale; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -75,7 +74,7 @@ public void testSimpleExplodedWar() throws Exception { // configure mojo resources[0].setDirectory(webAppResource.getAbsolutePath()); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "webResources", resources); mojo.execute(); @@ -117,7 +116,7 @@ public void testSimpleExplodedWarWTargetPath() throws Exception { // configure mojo resources[0].setDirectory(webAppResource.getAbsolutePath()); resources[0].setTargetPath("targetPath"); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "webResources", resources); mojo.execute(); @@ -153,7 +152,7 @@ public void testExplodedWarWithCustomWebXML() throws Exception { File webAppDirectory = new File(getTestDirectory(), testId); // configure mojo - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.setWebXml(new File(xmlSource, "web.xml")); mojo.execute(); @@ -189,7 +188,7 @@ public void testExplodedWarWithContainerConfigXML() throws Exception { File webAppDirectory = new File(getTestDirectory(), testId); // configure mojo - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.setContainerConfigXML(new File(xmlSource, "config.xml")); mojo.execute(); @@ -234,7 +233,7 @@ public void testExplodedWarWithSimpleExternalWARFile() throws Exception { // configure mojo project.addArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "workDirectory", workDirectory); mojo.execute(); @@ -279,7 +278,7 @@ public void testExplodedWarMergeWarLocalFileOverride() throws Exception { // configure mojo project.addArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "workDirectory", workDirectory); mojo.execute(); @@ -296,7 +295,7 @@ public void testExplodedWarMergeWarLocalFileOverride() throws Exception { expectedFile.setLastModified(time); project.addArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "workDirectory", workDirectory); mojo.execute(); @@ -324,7 +323,7 @@ public void testExplodedWarWithEJB() throws Exception { // configure mojo project.addArtifact(ejbArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -358,7 +357,7 @@ public void testExplodedWarWithJar() throws Exception { // configure mojo project.addArtifact(jarArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -394,7 +393,7 @@ public void testExplodedWarWithEJBClient() throws Exception { // configure mojo project.addArtifact(ejbArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -430,7 +429,7 @@ public void testExplodedWarWithTLD() throws Exception { // configure mojo project.addArtifact(tldArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -466,7 +465,7 @@ public void testExplodedWarWithPAR() throws Exception { // configure mojo project.addArtifact(parartifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -504,7 +503,7 @@ public void testExplodedWarWithAar() throws Exception { // configure mojo project.addArtifact(aarArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -542,7 +541,7 @@ public void testExplodedWarWithMar() throws Exception { // configure mojo project.addArtifact(marArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -580,7 +579,7 @@ public void testExplodedWarWithXar() throws Exception { // configure mojo project.addArtifact(xarArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -621,7 +620,7 @@ public void testExplodedWarWithDuplicateDependencies() throws Exception { ejbArtifactDup.setGroupId("org.dup.ejb"); project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -671,7 +670,7 @@ public void testExplodedWarDuplicateWithClassifier() throws Exception { project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -705,7 +704,7 @@ public void testExplodedWarWithClasses() throws Exception { File classesDir = createClassesDir(testId, false); // configure mojo - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -736,7 +735,7 @@ public void testExplodedWarWithSourceIncludeExclude() throws Exception { File webAppDirectory = new File(getTestDirectory(), testId); // configure mojo - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "warSourceIncludes", "**/*sit.jsp"); setVariableValueToObject(mojo, "warSourceExcludes", "**/last*.*"); mojo.execute(); @@ -779,7 +778,7 @@ public void testExplodedWarWithWarDependencyIncludeExclude() throws Exception { // configure mojo project.addArtifact(includeexcludeWarArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "dependentWarIncludes", "**/*Include.jsp,**/*.xml"); setVariableValueToObject(mojo, "dependentWarExcludes", "**/*Exclude*,**/MANIFEST.MF"); setVariableValueToObject(mojo, "workDirectory", workDirectory); @@ -822,7 +821,7 @@ public void testExplodedWarWithSourceModificationCheck() throws Exception { File webAppDirectory = new File(getTestDirectory(), testId); // configure mojo - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); // destination file is already created manually containing an "error" string // source is newer than the destination file @@ -873,7 +872,7 @@ public void testExplodedWarWithOutputFileNameMapping() throws Exception { // configure mojo project.addArtifact(jarArtifact); mojo.setOutputFileNameMapping("@{artifactId}@.@{extension}@"); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation @@ -915,7 +914,7 @@ public void testExplodedWarWithOutputFileNameMappingAndDuplicateDependencies() t project.addArtifact(ejbArtifact); project.addArtifact(ejbArtifactDup); mojo.setOutputFileNameMapping("@{artifactId}@.@{extension}@"); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); mojo.execute(); // validate operation diff --git a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java index c92b994f..41b563f4 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java @@ -19,7 +19,6 @@ package org.apache.maven.plugins.war; import java.io.File; -import java.util.LinkedList; import org.apache.maven.plugins.war.stub.MavenProjectBasicStub; import org.apache.maven.plugins.war.stub.ResourceStub; @@ -55,7 +54,7 @@ public void testSimpleExplodedInplaceWar() throws Exception { // configure mojo resources[0].setDirectory(webAppResource.getAbsolutePath()); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, null, project); + this.configureMojo(mojo, classesDir, webAppSource, null, project); setVariableValueToObject(mojo, "webResources", resources); mojo.execute(); 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 4cadc2a5..2443fd13 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; -import java.util.LinkedList; import java.util.Map; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -67,7 +66,7 @@ public void testSimpleWar() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -101,7 +100,7 @@ public void testSimpleWarPackagingExcludeWithIncludesRegEx() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -139,7 +138,7 @@ public void testSimpleWarPackagingExcludesWithRegEx() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -177,7 +176,7 @@ public void testClassifier() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "projectHelper", projectHelper); setVariableValueToObject(mojo, "classifier", "test-classifier"); setVariableValueToObject(mojo, "outputDirectory", outputDir); @@ -215,7 +214,7 @@ public void testPrimaryArtifact() throws Exception { warArtifact.setFile(new File("error.war")); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "projectHelper", projectHelper); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); @@ -256,7 +255,7 @@ public void testNotPrimaryArtifact() throws Exception { warArtifact.setFile(new File("error.war")); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "projectHelper", projectHelper); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); @@ -295,7 +294,7 @@ public void testMetaInfContent() throws Exception { createFile(configFile, ""); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -334,7 +333,7 @@ public void testMetaInfContentWithContainerConfig() throws Exception { createFile(configFile, ""); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -370,7 +369,7 @@ public void testFailOnMissingWebXmlFalse() throws Exception { File classesDir = createClassesDir(testId, true); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setFailOnMissingWebXml(false); @@ -404,7 +403,7 @@ public void testFailOnMissingWebXmlTrue() throws Exception { File classesDir = createClassesDir(testId, true); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setFailOnMissingWebXml(true); @@ -436,7 +435,7 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used() throws Excepti project.setArtifact(warArtifact); project.setFile(warArtifact.getFile()); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); @@ -470,7 +469,7 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed() throws Exce project.setArtifact(warArtifact); project.setFile(warArtifact.getFile()); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); @@ -495,7 +494,7 @@ public void testAttachClasses() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); @@ -523,7 +522,7 @@ public void testAttachClassesWithCustomClassifier() throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); mojo.setWebXml(new File(xmlSource, "web.xml")); diff --git a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java index 94502503..a68d2784 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java @@ -19,7 +19,6 @@ package org.apache.maven.plugins.war; import java.io.File; -import java.util.LinkedList; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -69,7 +68,7 @@ private File configureMojo(String testId) throws Exception { File xmlSource = createXMLConfigDir(testId, new String[] {"web.xml"}); project.setArtifact(warArtifact); - this.configureMojo(mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project); + this.configureMojo(mojo, classesDir, webAppSource, webAppDirectory, project); setVariableValueToObject(mojo, "outputDirectory", outputDir); setVariableValueToObject(mojo, "warName", warName); setVariableValueToObject(mojo, "workDirectory", new File(getTestDirectory(), "work"));