diff --git a/pom.xml b/pom.xml index fe5e2c89..7634a013 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 3.5.1 3.2.0 3.2.5 - 7 + 8 2021-09-05T09:31:59Z 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 2ab6047c..24a8eb50 100644 --- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java @@ -638,7 +638,7 @@ private class DefaultWarPackagingContext this.artifactFactory = artifactFactory; this.filteringDeploymentDescriptors = filteringDeploymentDescriptors; this.nonFilteredFileExtensions = - nonFilteredFileExtensions == null ? Collections.emptyList() : nonFilteredFileExtensions; + nonFilteredFileExtensions == null ? Collections.emptyList() : nonFilteredFileExtensions; this.resourceEncoding = resourceEncoding; this.propertiesEncoding = propertiesEncoding; // This is kinda stupid but if we loop over the current overlays and we request the path structure 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 d904fc58..171275f3 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 @@ -21,6 +21,8 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.attribute.BasicFileAttributes; import org.apache.commons.io.input.XmlStreamReader; import org.apache.maven.artifact.Artifact; @@ -342,14 +344,15 @@ protected boolean copyFile( WarPackagingContext context, File source, File desti { context.addResource( targetFilename ); - if ( onlyIfModified && destination.lastModified() >= source.lastModified() ) + BasicFileAttributes readAttributes = Files.readAttributes( source.toPath(), BasicFileAttributes.class ); + if ( onlyIfModified && destination.lastModified() >= readAttributes.lastModifiedTime().toMillis() ) { context.getLog().debug( " * " + targetFilename + " is up to date." ); return false; } else { - if ( source.isDirectory() ) + if ( readAttributes.isDirectory() ) { context.getLog().warn( " + " + targetFilename + " is packaged from the source folder" ); @@ -364,16 +367,14 @@ protected boolean copyFile( WarPackagingContext context, File source, File desti { String msg = "Failed to create " + targetFilename; context.getLog().error( msg, e ); - IOException ioe = new IOException( msg ); - ioe.initCause( e ); - throw ioe; + throw new IOException( msg, e ); } } else { FileUtils.copyFile( source.getCanonicalFile(), destination ); // preserve timestamp - destination.setLastModified( source.lastModified() ); + destination.setLastModified( readAttributes.lastModifiedTime().toMillis() ); context.getLog().debug( " + " + targetFilename + " has been copied." ); } return true; 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 e562398e..f1409409 100644 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java @@ -109,7 +109,7 @@ protected File setUpMojo( final String testId, ArtifactStub[] artifactStubs, Str } } - configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "workDirectory", workDirectory ); return webAppDirectory; 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 22ff280d..45faf0fd 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java @@ -80,7 +80,7 @@ public void testSimpleExplodedWar() // configure mojo resources[0].setDirectory( webAppResource.getAbsolutePath() ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "webResources", resources ); mojo.execute(); @@ -124,7 +124,7 @@ public void testSimpleExplodedWarWTargetPath() // configure mojo resources[0].setDirectory( webAppResource.getAbsolutePath() ); resources[0].setTargetPath( "targetPath" ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "webResources", resources ); mojo.execute(); @@ -162,7 +162,7 @@ public void testExplodedWar_WithCustomWebXML() File webAppDirectory = new File( getTestDirectory(), testId ); // configure mojo - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); mojo.execute(); @@ -200,7 +200,7 @@ public void testExplodedWar_WithContainerConfigXML() File webAppDirectory = new File( getTestDirectory(), testId ); // configure mojo - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.setContainerConfigXML( new File( xmlSource, "config.xml" ) ); mojo.execute(); @@ -246,7 +246,7 @@ public void testExplodedWar_WithSimpleExternalWARFile() // configure mojo project.addArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "workDirectory", workDirectory ); mojo.execute(); @@ -293,7 +293,7 @@ public void testExplodedWarMergeWarLocalFileOverride() // configure mojo project.addArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "workDirectory", workDirectory ); mojo.execute(); @@ -309,7 +309,7 @@ public void testExplodedWarMergeWarLocalFileOverride() expectedFile.setLastModified( time ); project.addArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "workDirectory", workDirectory ); mojo.execute(); @@ -394,7 +394,7 @@ public void testExplodedWar_WithEJB() // configure mojo project.addArtifact( ejbArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -431,7 +431,7 @@ public void testExplodedWarWithJar() // configure mojo project.addArtifact( jarArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -469,7 +469,7 @@ public void testExplodedWar_WithEJBClient() // configure mojo project.addArtifact( ejbArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -507,7 +507,7 @@ public void testExplodedWar_WithTLD() // configure mojo project.addArtifact( tldArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -545,7 +545,7 @@ public void testExplodedWar_WithPAR() // configure mojo project.addArtifact( parartifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -585,7 +585,7 @@ public void testExplodedWarWithAar() // configure mojo project.addArtifact( aarArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -625,7 +625,7 @@ public void testExplodedWarWithMar() // configure mojo project.addArtifact( marArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -665,7 +665,7 @@ public void testExplodedWarWithXar() // configure mojo project.addArtifact( xarArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -708,7 +708,7 @@ public void testExplodedWar_WithDuplicateDependencies() ejbArtifactDup.setGroupId( "org.dup.ejb" ); project.addArtifact( ejbArtifact ); project.addArtifact( ejbArtifactDup ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -760,7 +760,7 @@ public void testExplodedWar_DuplicateWithClassifier() project.addArtifact( ejbArtifact ); project.addArtifact( ejbArtifactDup ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -796,7 +796,7 @@ public void testExplodedWar_WithClasses() File classesDir = createClassesDir( testId, false ); // configure mojo - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -829,7 +829,7 @@ public void testExplodedWar_WithSourceIncludeExclude() File webAppDirectory = new File( getTestDirectory(), testId ); // configure mojo - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "warSourceIncludes", "**/*sit.jsp" ); setVariableValueToObject( mojo, "warSourceExcludes", "**/last*.*" ); mojo.execute(); @@ -874,7 +874,7 @@ public void testExplodedWar_WithWarDependencyIncludeExclude() // configure mojo project.addArtifact( includeexcludeWarArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "dependentWarIncludes", "**/*Include.jsp,**/*.xml" ); setVariableValueToObject( mojo, "dependentWarExcludes", "**/*Exclude*,**/MANIFEST.MF" ); setVariableValueToObject( mojo, "workDirectory", workDirectory ); @@ -919,7 +919,7 @@ public void testExplodedWarWithSourceModificationCheck() File webAppDirectory = new File( getTestDirectory(), testId ); // configure mojo - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); // destination file is already created manually containing an "error" string // source is newer than the destination file @@ -982,7 +982,7 @@ public void testExplodedWarWithOutputFileNameMapping() // configure mojo project.addArtifact( jarArtifact ); mojo.setOutputFileNameMapping( "@{artifactId}@.@{extension}@" ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); mojo.execute(); // validate operation @@ -1026,7 +1026,7 @@ public void testExplodedWarWithOutputFileNameMappingAndDuplicateDependencies() project.addArtifact( ejbArtifact ); project.addArtifact( ejbArtifactDup ); mojo.setOutputFileNameMapping( "@{artifactId}@.@{extension}@" ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), 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 d93433cc..8cf45573 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java @@ -70,7 +70,7 @@ public void testSimpleExplodedInplaceWar() // configure mojo resources[0].setDirectory( webAppResource.getAbsolutePath() ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, null, project ); + this.configureMojo( mojo, new LinkedList<>(), 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 7a313ec2..84a8ce82 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java @@ -81,7 +81,7 @@ public void testSimpleWar() File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); @@ -110,7 +110,7 @@ public void testSimpleWarPackagingExcludeWithIncludesRegEx() File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); @@ -142,7 +142,7 @@ public void testClassifier() File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "projectHelper", projectHelper ); setVariableValueToObject( mojo, "classifier", "test-classifier" ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); @@ -175,7 +175,7 @@ public void testPrimaryArtifact() warArtifact.setFile( new File( "error.war" ) ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "projectHelper", projectHelper ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); @@ -211,7 +211,7 @@ public void testNotPrimaryArtifact() warArtifact.setFile( new File( "error.war" ) ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "projectHelper", projectHelper ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); @@ -245,7 +245,7 @@ public void testMetaInfContent() createFile( configFile, "" ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); @@ -279,7 +279,7 @@ public void testMetaInfContentWithContainerConfig() createFile( configFile, "" ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); @@ -310,7 +310,7 @@ public void testFailOnMissingWebXmlFalse() File classesDir = createClassesDir( testId, true ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setFailOnMissingWebXml( false ); @@ -341,7 +341,7 @@ public void testFailOnMissingWebXmlTrue() File classesDir = createClassesDir( testId, true ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setFailOnMissingWebXml( true ); @@ -378,7 +378,7 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30Used() project.setArtifact( warArtifact ); project.setFile( warArtifact.getFile() ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); @@ -410,7 +410,7 @@ public void testFailOnMissingWebXmlNotSpecifiedAndServlet30NotUsed() project.setArtifact( warArtifact ); project.setFile( warArtifact.getFile() ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); @@ -440,7 +440,7 @@ public void testAttachClasses() File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); mojo.setWebXml( new File( xmlSource, "web.xml" ) ); @@ -469,7 +469,7 @@ public void testAttachClassesWithCustomClassifier() File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), 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/WarOverlaysTest.java b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java index aca97786..d944e6fa 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java @@ -329,7 +329,7 @@ public void testOverlaysIncludesExcludesWithMultipleDefinitions() Overlay over4 = new DefaultOverlay( overlay2 ); - mojo.setOverlays( new LinkedList() ); + mojo.setOverlays( new LinkedList<>() ); mojo.addOverlay( over1 ); mojo.addOverlay( over2 ); mojo.addOverlay( over3 ); @@ -399,7 +399,7 @@ public void testOverlaysIncludesExcludesWithMultipleDefinitions2() Overlay over4 = new DefaultOverlay( overlay2 ); - mojo.setOverlays( new LinkedList() ); + mojo.setOverlays( new LinkedList<>() ); mojo.addOverlay( over1 ); mojo.addOverlay( over2 ); mojo.addOverlay( over3 ); 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 88f66553..cc61d2ea 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarZipTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarZipTest.java @@ -80,7 +80,7 @@ private File configureMojo( String testId ) File xmlSource = createXMLConfigDir( testId, new String[] { "web.xml" } ); project.setArtifact( warArtifact ); - this.configureMojo( mojo, new LinkedList(), classesDir, webAppSource, webAppDirectory, project ); + this.configureMojo( mojo, new LinkedList<>(), classesDir, webAppSource, webAppDirectory, project ); setVariableValueToObject( mojo, "outputDirectory", outputDir ); setVariableValueToObject( mojo, "warName", warName ); setVariableValueToObject( mojo, "workDirectory", new File( getTestDirectory(), "work" ) ); diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java index e9a58ab1..831ddba5 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java @@ -50,13 +50,13 @@ private void initializeParentFields() { // the pom should be located in the isolated dummy root super.setFile( new File( getBasedir(), "pom.xml" ) ); - super.setDependencyArtifacts( new HashSet() ); - super.setArtifacts( new HashSet() ); - super.setExtensionArtifacts( new HashSet() ); - super.setRemoteArtifactRepositories( new LinkedList() ); - super.setPluginArtifactRepositories( new LinkedList() ); - super.setCollectedProjects( new LinkedList() ); - super.setActiveProfiles( new LinkedList() ); + super.setDependencyArtifacts( new HashSet<>() ); + super.setArtifacts( new HashSet<>() ); + super.setExtensionArtifacts( new HashSet<>() ); + super.setRemoteArtifactRepositories( new LinkedList<>() ); + super.setPluginArtifactRepositories( new LinkedList<>() ); + super.setCollectedProjects( new LinkedList<>() ); + super.setActiveProfiles( new LinkedList<>() ); super.setOriginalModel( null ); super.setExecutionProject( this ); super.setBuild( getBuild() ); diff --git a/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java b/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java index 0e135de2..3b2b1859 100644 --- a/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java +++ b/src/test/java/org/apache/maven/plugins/war/util/WebappStructureTest.java @@ -34,13 +34,13 @@ public class WebappStructureTest { public void testUnknownFileNotAvailable() { - final WebappStructure structure = new WebappStructure( new ArrayList() ); + final WebappStructure structure = new WebappStructure( new ArrayList<>() ); assertFalse( structure.isRegistered( "/foo/bar.txt" ) ); } public void testRegisterSamePathTwice() { - final WebappStructure structure = new WebappStructure( new ArrayList() ); + final WebappStructure structure = new WebappStructure( new ArrayList<>() ); structure.registerFile( "overlay1", "WEB-INF/web.xml" ); assertFalse( structure.registerFile( "currentBuild", "WEB-INF/web.xml" ) ); } @@ -48,7 +48,7 @@ public void testRegisterSamePathTwice() public void testRegisterForced() { final String path = "WEB-INF/web.xml"; - final WebappStructure structure = new WebappStructure( new ArrayList() ); + final WebappStructure structure = new WebappStructure( new ArrayList<>() ); assertFalse("New file should return false", structure.registerFileForced( "overlay1", path )); assertEquals( "overlay1", structure.getOwner( path ) ); @@ -57,7 +57,7 @@ public void testRegisterForced() public void testRegisterSamePathTwiceForced() { final String path = "WEB-INF/web.xml"; - final WebappStructure structure = new WebappStructure( new ArrayList() ); + final WebappStructure structure = new WebappStructure( new ArrayList<>() ); structure.registerFile( "overlay1", path ); assertEquals( "overlay1", structure.getOwner( path ) ); assertTrue("owner replacement should have returned true",