diff --git a/pom.xml b/pom.xml index f2aa0fe8..f81aedca 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.maven.plugins maven-plugins - 41 + 44 @@ -127,6 +127,7 @@ org.apache.maven.plugin-tools maven-plugin-annotations + ${version.maven-plugin-tools} provided 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 874ca2fd..2a357b05 100644 --- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java +++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java @@ -598,6 +598,7 @@ private class DefaultWarPackagingContext implements WarPackagingContext { * @param failOnMissingWebXml Flag to check whether we should ignore missing web.xml or not * @param outputTimestamp the output timestamp for reproducible archive creation */ + @SuppressWarnings("checkstyle:ParameterNumber") DefaultWarPackagingContext( final File webappDirectory, final WebappStructure webappStructure, 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 1c872f8e..f1bd3536 100644 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java @@ -240,7 +240,7 @@ class FileFilterImpl implements FileFilter { private final int webAppDirIndex; - public FileFilterImpl(File webAppDirectory, String[] rejectedFilePaths) { + FileFilterImpl(File webAppDirectory, String[] rejectedFilePaths) { if (rejectedFilePaths != null) { this.rejectedFilePaths = Arrays.asList(rejectedFilePaths); } else { 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 bbc2556e..cbbdf578 100644 --- a/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarMojoTest.java @@ -52,7 +52,7 @@ public abstract class AbstractWarMojoTest extends AbstractMojoTestCase { * * @param mojo The mojo to be tested. * @param filters The list of filters. - * @param classesDir The classes directory. + * @param classesDir The classes' directory. * @param webAppSource The webAppSource. * @param webAppDir The webAppDir folder. * @param project The Maven project. @@ -94,14 +94,14 @@ protected void configureMojo( */ protected File createXMLConfigDir(String id, String[] xmlFiles) throws Exception { File xmlConfigDir = new File(getTestDirectory(), "/" + id + "-test-data/xml-config"); - File XMLFile; + File xmlFile; createDir(xmlConfigDir); if (xmlFiles != null) { for (String o : xmlFiles) { - XMLFile = new File(xmlConfigDir, o); - createFile(XMLFile); + xmlFile = new File(xmlConfigDir, o); + createFile(xmlFile); } } 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 1837a5e6..9d4aff65 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java @@ -64,9 +64,10 @@ protected File getTestDirectory() { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithResourceFiltering() throws Exception { + @SuppressWarnings("checkstyle:MethodLength") + public void testExplodedWarWithResourceFiltering() throws Exception { // setup test data - String testId = "ExplodedWar_WithResourceFiltering"; + String testId = "ExplodedWarWithResourceFiltering"; MavenProjectBasicStub project = new MavenProjectBasicStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); 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 213e7db9..637e133c 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java @@ -143,9 +143,9 @@ public void testSimpleExplodedWarWTargetPath() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithCustomWebXML() throws Exception { + public void testExplodedWarWithCustomWebXML() throws Exception { // setup test data - String testId = "ExplodedWar_WithCustomWebXML"; + String testId = "ExplodedWarWithCustomWebXML"; MavenProjectBasicStub project = new MavenProjectBasicStub(); File webAppSource = createWebAppSource(testId); File classesDir = createClassesDir(testId, true); @@ -179,9 +179,9 @@ public void testExplodedWar_WithCustomWebXML() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithContainerConfigXML() throws Exception { + public void testExplodedWarWithContainerConfigXML() throws Exception { // setup test data - String testId = "ExplodedWar_WithContainerConfigXML"; + String testId = "ExplodedWarWithContainerConfigXML"; MavenProjectBasicStub project = new MavenProjectBasicStub(); File classesDir = createClassesDir(testId, true); File webAppSource = createWebAppSource(testId); @@ -216,12 +216,12 @@ public void testExplodedWar_WithContainerConfigXML() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithSimpleExternalWARFile() throws Exception { + public void testExplodedWarWithSimpleExternalWARFile() throws Exception { // setup test data MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); WarArtifactStub warArtifact = new WarArtifactStub(getBasedir()); - String testId = "ExplodedWar_WithSimpleExternalWARFile"; + String testId = "ExplodedWarWithSimpleExternalWARFile"; File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); File classesDir = createClassesDir(testId, true); @@ -310,9 +310,9 @@ public void testExplodedWarMergeWarLocalFileOverride() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithEJB() throws Exception { + public void testExplodedWarWithEJB() throws Exception { // setup test data - String testId = "ExplodedWar_WithEJB"; + String testId = "ExplodedWarWithEJB"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -381,9 +381,9 @@ public void testExplodedWarWithJar() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithEJBClient() throws Exception { + public void testExplodedWarWithEJBClient() throws Exception { // setup test data - String testId = "ExplodedWar_WithEJB"; + String testId = "ExplodedWarWithEJB"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -417,9 +417,9 @@ public void testExplodedWar_WithEJBClient() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithTLD() throws Exception { + public void testExplodedWarWithTLD() throws Exception { // setup test data - String testId = "ExplodedWar_WithTLD"; + String testId = "ExplodedWarWithTLD"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -453,9 +453,9 @@ public void testExplodedWar_WithTLD() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithPAR() throws Exception { + public void testExplodedWarWithPAR() throws Exception { // setup test data - String testId = "ExplodedWar_WithPAR"; + String testId = "ExplodedWarWithPAR"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -603,9 +603,9 @@ public void testExplodedWarWithXar() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithDuplicateDependencies() throws Exception { + public void testExplodedWarWithDuplicateDependencies() throws Exception { // setup test data - String testId = "ExplodedWar_WithDuplicateDependencies"; + String testId = "ExplodedWarWithDuplicateDependencies"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -647,9 +647,9 @@ public void testExplodedWar_WithDuplicateDependencies() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_DuplicateWithClassifier() throws Exception { + public void testExplodedWarDuplicateWithClassifier() throws Exception { // setup test data - String testId = "ExplodedWar_DuplicateWithClassifier"; + String testId = "ExplodedWarDuplicateWithClassifier"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -697,9 +697,9 @@ public void testExplodedWar_DuplicateWithClassifier() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithClasses() throws Exception { + public void testExplodedWarWithClasses() throws Exception { // setup test data - String testId = "ExplodedWar_WithClasses"; + String testId = "ExplodedWarWithClasses"; MavenProjectBasicStub project = new MavenProjectBasicStub(); File webAppDirectory = new File(getTestDirectory(), testId); File webAppSource = createWebAppSource(testId); @@ -728,9 +728,9 @@ public void testExplodedWar_WithClasses() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithSourceIncludeExclude() throws Exception { + public void testExplodedWarWithSourceIncludeExclude() throws Exception { // setup test data - String testId = "ExplodedWar_WithSourceIncludeExclude"; + String testId = "ExplodedWarWithSourceIncludeExclude"; MavenProjectBasicStub project = new MavenProjectBasicStub(); File webAppSource = createWebAppSource(testId); File classesDir = createClassesDir(testId, true); @@ -763,9 +763,9 @@ public void testExplodedWar_WithSourceIncludeExclude() throws Exception { /** * @throws Exception in case of an error. */ - public void testExplodedWar_WithWarDependencyIncludeExclude() throws Exception { + public void testExplodedWarWithWarDependencyIncludeExclude() throws Exception { // setup test data - String testId = "ExplodedWar_WithWarDependencyIncludeExclude"; + String testId = "ExplodedWarWithWarDependencyIncludeExclude"; MavenProjectArtifactsStub project = new MavenProjectArtifactsStub(); IncludeExcludeWarArtifactStub includeexcludeWarArtifact = new IncludeExcludeWarArtifactStub(getBasedir()); File webAppDirectory = new File(getTestDirectory(), testId); 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 f35b355f..83183f81 100644 --- a/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/war/WarInPlaceMojoTest.java @@ -25,7 +25,7 @@ import org.apache.maven.plugins.war.stub.ResourceStub; public class WarInPlaceMojoTest extends AbstractWarMojoTest { - protected static final String pomFilePath = + protected static final String POM_FILE_PATH = getBasedir() + "/target/test-classes/unit/warexplodedinplacemojo/plugin-config.xml"; protected File getTestDirectory() throws Exception { @@ -37,7 +37,7 @@ protected File getTestDirectory() throws Exception { public void setUp() throws Exception { super.setUp(); - mojo = (WarInPlaceMojo) lookupMojo("inplace", pomFilePath); + mojo = (WarInPlaceMojo) lookupMojo("inplace", POM_FILE_PATH); assertNotNull(mojo); } diff --git a/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java index 02d3603e..933c1ea6 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.war.stub; +import java.util.Objects; + import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.DefaultArtifactHandler; @@ -27,8 +29,8 @@ public abstract class AbstractArtifactStub extends ArtifactStub { protected String basedir; - public AbstractArtifactStub(String _basedir) { - basedir = _basedir; + public AbstractArtifactStub(String basedir) { + this.basedir = basedir; } public String getVersion() { @@ -128,4 +130,9 @@ public boolean equals(Object o) { return true; } + + @Override + public int hashCode() { + return Objects.hashCode(basedir); + } } diff --git a/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStub.java index 7414a7ae..a3ee0f74 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStub.java @@ -26,8 +26,8 @@ public class EJBArtifactStub extends AbstractArtifactStub { protected String groupId; - public EJBArtifactStub(String _basedir) { - super(_basedir); + public EJBArtifactStub(String basedir) { + super(basedir); } public void setGroupId(String id) { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStubWithClassifier.java b/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStubWithClassifier.java index 99a91d6c..2545c7e4 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStubWithClassifier.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/EJBArtifactStubWithClassifier.java @@ -27,8 +27,8 @@ public class EJBArtifactStubWithClassifier extends AbstractArtifactStub { protected String groupId; protected String classifier; - public EJBArtifactStubWithClassifier(String _basedir) { - super(_basedir); + public EJBArtifactStubWithClassifier(String basedir) { + super(basedir); } public void setGroupId(String id) { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/EJBClientArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/EJBClientArtifactStub.java index 089d5511..c4e49b17 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/EJBClientArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/EJBClientArtifactStub.java @@ -26,8 +26,8 @@ public class EJBClientArtifactStub extends AbstractArtifactStub { protected String groupId; - public EJBClientArtifactStub(String _basedir) { - super(_basedir); + public EJBClientArtifactStub(String basedir) { + super(basedir); } public void setGroupId(String id) { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/PARArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/PARArtifactStub.java index d92b10b9..86a19100 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/PARArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/PARArtifactStub.java @@ -21,8 +21,8 @@ import java.io.File; public class PARArtifactStub extends AbstractArtifactStub { - public PARArtifactStub(String _basedir) { - super(_basedir); + public PARArtifactStub(String basedir) { + super(basedir); } public String getType() { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/ProjectHelperStub.java b/src/test/java/org/apache/maven/plugins/war/stub/ProjectHelperStub.java index 65b3316a..8f068023 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/ProjectHelperStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/ProjectHelperStub.java @@ -48,10 +48,10 @@ public void attachArtifact(MavenProject project, File artifactFile, String artif public void attachArtifact(MavenProject project, String artifactType, File artifactFile) {} public void attachArtifact( - MavenProject project, String _artifactType, String _artifactClassifier, File _artifactFile) { - artifactType = _artifactType; - artifactClassifier = _artifactClassifier; - artifactFile = _artifactFile; + MavenProject project, String artifactType, String artifactClassifier, File artifactFile) { + this.artifactType = artifactType; + this.artifactClassifier = artifactClassifier; + this.artifactFile = artifactFile; } @SuppressWarnings("rawtypes") diff --git a/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java b/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java index 789dc9dc..587389a2 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java @@ -39,8 +39,8 @@ public List getExcludes() { return new ArrayList<>(); } - public void setDirectory(String _directory) { - directory = _directory; + public void setDirectory(String directory) { + this.directory = directory; } public String getDirectory() { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/TLDArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/TLDArtifactStub.java index 8194431a..c4d9a902 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/TLDArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/TLDArtifactStub.java @@ -21,8 +21,8 @@ import java.io.File; public class TLDArtifactStub extends AbstractArtifactStub { - public TLDArtifactStub(String _basedir) { - super(_basedir); + public TLDArtifactStub(String basedir) { + super(basedir); } public String getType() { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/WarArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/WarArtifactStub.java index a3ee43d9..93f05065 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/WarArtifactStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/WarArtifactStub.java @@ -33,8 +33,8 @@ public class WarArtifactStub extends AbstractArtifactStub { private File file; - public WarArtifactStub(String _basedir) { - super(_basedir); + public WarArtifactStub(String basedir) { + super(basedir); } public String getType() { @@ -49,8 +49,8 @@ public String getArtifactId() { } } - public void setArtifactId(String _artifactId) { - artifactId = _artifactId; + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; } public String getGroupId() { @@ -73,8 +73,8 @@ public File getFile() { } } - public void setFile(File _file) { - file = _file; + public void setFile(File file) { + this.file = file; } public String getClassifier() { diff --git a/src/test/java/org/apache/maven/plugins/war/stub/WarOverlayStub.java b/src/test/java/org/apache/maven/plugins/war/stub/WarOverlayStub.java index 0f3d7ced..eb507083 100644 --- a/src/test/java/org/apache/maven/plugins/war/stub/WarOverlayStub.java +++ b/src/test/java/org/apache/maven/plugins/war/stub/WarOverlayStub.java @@ -29,8 +29,8 @@ public class WarOverlayStub extends AbstractArtifactStub { private File file; - public WarOverlayStub(String _basedir, String artifactId, File warFile) { - super(_basedir); + public WarOverlayStub(String basedir, String artifactId, File warFile) { + super(basedir); if (artifactId == null) { throw new NullPointerException("Id could not be null."); }