diff --git a/pom.xml b/pom.xml
index 246e3397..f94c0cc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,11 +86,11 @@ under the License.
7.3.0
1.7.36
1.4.1
- 1.12.0
+ 2.0.0-M12
3.11.0
- 3.12.1
- 3.4.3
- 3.3.0
+ 3.20.0
+ 3.7.0
+ 3.4.0
2024-07-10T19:17:23Z
@@ -193,55 +193,18 @@ under the License.
org.apache.maven.doxia
doxia-sink-api
${doxiaVersion}
-
-
- org.codehaus.plexus
- plexus-container-default
-
-
org.apache.maven.doxia
doxia-core
${doxiaVersion}
-
-
- org.codehaus.plexus
- plexus-container-default
-
-
-
-
- org.apache.maven.doxia
- doxia-site-renderer
- 1.11.1
- runtime
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- org.codehaus.plexus
- plexus-container-default
-
-
- org.codehaus.plexus
- plexus-component-api
-
-
org.apache.maven.reporting
maven-reporting-impl
- 3.2.0
+ 4.0.0-M15
diff --git a/src/it/MPMD-165/verify.groovy b/src/it/MPMD-165/verify.groovy
index 116a28f5..94cc1d66 100644
--- a/src/it/MPMD-165/verify.groovy
+++ b/src/it/MPMD-165/verify.groovy
@@ -17,7 +17,7 @@
* under the License.
*/
-File pmdHtml = new File( basedir, "target/site/pmd.html" );
+File pmdHtml = new File( basedir, "target/reports/pmd.html" );
assert pmdHtml.exists()
// Groovy's getText() automatically detects the correct encoding, so that UTF-16 works out of the box
diff --git a/src/it/MPMD-289-format-html-check/verify.groovy b/src/it/MPMD-289-format-html-check/verify.groovy
index 04afaaeb..aa62e282 100644
--- a/src/it/MPMD-289-format-html-check/verify.groovy
+++ b/src/it/MPMD-289-format-html-check/verify.groovy
@@ -24,11 +24,11 @@ assert buildLog.exists()
File pmdXml = new File( basedir, 'target/pmd.xml' )
assert pmdXml.exists()
-File pmdHtmlReport = new File ( basedir, 'target/site/pmd.html' )
+File pmdHtmlReport = new File ( basedir, 'target/reports/pmd.html' )
assert pmdHtmlReport.exists()
File cpdXml = new File( basedir, 'target/cpd.xml' )
assert cpdXml.exists()
-File cpdHtmlReport = new File ( basedir, 'target/site/cpd.html' )
+File cpdHtmlReport = new File ( basedir, 'target/reports/cpd.html' )
assert cpdHtmlReport.exists()
diff --git a/src/it/MPMD-304-toolchain-support/verify.groovy b/src/it/MPMD-304-toolchain-support/verify.groovy
index 1f4bbc60..d73cba8d 100644
--- a/src/it/MPMD-304-toolchain-support/verify.groovy
+++ b/src/it/MPMD-304-toolchain-support/verify.groovy
@@ -44,16 +44,16 @@ assert buildLog.text.contains('[WARNING] CPD ' + pmdVersion + ' has found 1 dupl
assert pmdXml.text.contains( 'MPMD-80 included
- Test that the cpd.xml and pmd.xml files are included in the generated site.
+ Test that the cpd.xml and pmd.xml files are included in the generated reports output directory.
@@ -48,7 +48,7 @@ under the License.
@project.version@
false
- true
+ true
diff --git a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
index f5f0799d..97cf3d47 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/AbstractPmdReport.java
@@ -39,6 +39,7 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.Reporting;
+import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
@@ -160,12 +161,12 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
protected boolean aggregate;
/**
- * Whether to include the xml files generated by PMD/CPD in the site.
+ * Whether to include the XML files generated by PMD/CPD in the {@link #getReportOutputDirectory()}.
*
* @since 3.0
*/
@Parameter(defaultValue = "false")
- protected boolean includeXmlInSite;
+ protected boolean includeXmlInReports;
/**
* Skip the PMD/CPD report generation if there are no violations or duplications found. Defaults to
@@ -252,12 +253,6 @@ public abstract class AbstractPmdReport extends AbstractMavenReport {
// Read-only parameters
// ----------------------------------------------------------------------
- /**
- * The projects in the reactor for aggregation report.
- */
- @Parameter(property = "reactorProjects", readonly = true)
- protected List reactorProjects;
-
/**
* The current build session instance. This is used for
* toolchain manager API calls and for dependency resolver API calls.
@@ -276,6 +271,14 @@ protected MavenProject getProject() {
return project;
}
+ protected List getReactorProjects() {
+ return reactorProjects;
+ }
+
+ protected MojoExecution getMojoExecution() {
+ return mojoExecution;
+ }
+
protected String constructXRefLocation(boolean test) {
String location = null;
if (linkXRef) {
@@ -460,11 +463,7 @@ protected boolean isXml() {
return "xml".equals(format);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean canGenerateReport() {
+ protected boolean canGenerateReportInternal() throws MavenReportException {
if (!showPmdLog && !warnedAboutShowPmdLog) {
getLog().warn("The parameter \"showPmdLog\" has been deprecated and will be removed."
+ "Setting it to \"false\" has no effect.");
@@ -490,7 +489,7 @@ public boolean canGenerateReport() {
return false;
}
} catch (IOException e) {
- getLog().error(e);
+ throw new MavenReportException("Failed to determine files to process for PMD", e);
}
return true;
}
diff --git a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
index 39531d80..b087aeb7 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
@@ -144,24 +144,16 @@ public void executeReport(Locale locale) throws MavenReportException {
}
@Override
- public boolean canGenerateReport() {
+ public boolean canGenerateReport() throws MavenReportException {
if (skip) {
- getLog().info("Skipping CPD execution");
return false;
}
- boolean result = super.canGenerateReport();
+ boolean result = canGenerateReportInternal();
if (result) {
- try {
- executeCpd();
- if (skipEmptyReport) {
- result = cpdResult.hasDuplications();
- if (!result) {
- getLog().debug("Skipping report since skipEmptyReport is true and there are no CPD issues.");
- }
- }
- } catch (MavenReportException e) {
- throw new RuntimeException(e);
+ executeCpd();
+ if (skipEmptyReport) {
+ result = cpdResult.hasDuplications();
}
}
return result;
@@ -190,7 +182,7 @@ private void executeCpd() throws MavenReportException {
request.setTargetDirectory(targetDirectory.getAbsolutePath());
request.setOutputEncoding(getOutputEncoding());
request.setFormat(format);
- request.setIncludeXmlInSite(includeXmlInSite);
+ request.setIncludeXmlInReports(includeXmlInReports);
request.setReportOutputDirectory(getReportOutputDirectory().getAbsolutePath());
Toolchain tc = getToolchain();
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index 3f54f743..4c9cd6c8 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -313,25 +313,16 @@ public void executeReport(Locale locale) throws MavenReportException {
}
@Override
- public boolean canGenerateReport() {
+ public boolean canGenerateReport() throws MavenReportException {
if (skip) {
- getLog().info("Skipping PMD execution");
return false;
}
- boolean result = super.canGenerateReport();
+ boolean result = canGenerateReportInternal();
if (result) {
- try {
- executePmd();
- if (skipEmptyReport) {
- result = pmdResult.hasViolations();
- if (!result) {
- getLog().debug("Skipping report since skipEmptyReport is true and "
- + "there are no PMD violations.");
- }
- }
- } catch (MavenReportException e) {
- throw new RuntimeException(e);
+ executePmd();
+ if (skipEmptyReport) {
+ result = pmdResult.hasViolations();
}
}
return result;
@@ -370,7 +361,7 @@ private void executePmd() throws MavenReportException {
request.setOutputEncoding(getOutputEncoding());
request.setFormat(format);
request.setSkipPmdError(skipPmdError);
- request.setIncludeXmlInSite(includeXmlInSite);
+ request.setIncludeXmlInReports(includeXmlInReports);
request.setReportOutputDirectory(getReportOutputDirectory().getAbsolutePath());
request.setLogLevel(determineCurrentRootLogLevel());
diff --git a/src/main/java/org/apache/maven/plugins/pmd/exec/CpdReportConsumer.java b/src/main/java/org/apache/maven/plugins/pmd/exec/CpdReportConsumer.java
index f383e827..86b64393 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/exec/CpdReportConsumer.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/exec/CpdReportConsumer.java
@@ -67,12 +67,12 @@ public void accept(CPDReport report) {
private void writeXmlReport(CPDReport cpd) throws IOException {
File targetFile = writeReport(cpd, new XMLRenderer(request.getOutputEncoding()), "xml");
- if (request.isIncludeXmlInSite()) {
- File siteDir = new File(request.getReportOutputDirectory());
- if (!siteDir.exists() && !siteDir.mkdirs()) {
- throw new IOException("Couldn't create report output directory: " + siteDir);
+ if (request.isIncludeXmlInReports()) {
+ File outputDirectory = new File(request.getReportOutputDirectory());
+ if (!outputDirectory.exists() && !outputDirectory.mkdirs()) {
+ throw new IOException("Couldn't create report output directory: " + outputDirectory);
}
- FileUtils.copyFile(targetFile, new File(siteDir, "cpd.xml"));
+ FileUtils.copyFile(targetFile, new File(outputDirectory, "cpd.xml"));
}
}
@@ -88,7 +88,7 @@ private File writeReport(CPDReport cpd, CPDReportRenderer renderer, String exten
File targetDir = new File(request.getTargetDirectory());
if (!targetDir.exists() && !targetDir.mkdirs()) {
- throw new IOException("Couldn't create report output directory: " + targetDir);
+ throw new IOException("Couldn't create report target directory: " + targetDir);
}
File targetFile = new File(targetDir, "cpd." + extension);
diff --git a/src/main/java/org/apache/maven/plugins/pmd/exec/CpdRequest.java b/src/main/java/org/apache/maven/plugins/pmd/exec/CpdRequest.java
index 7ecc7109..32e3c396 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/exec/CpdRequest.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/exec/CpdRequest.java
@@ -50,7 +50,7 @@ public class CpdRequest implements Serializable {
private String targetDirectory;
private String outputEncoding;
private String format;
- private boolean includeXmlInSite;
+ private boolean includeXmlInReports;
private String reportOutputDirectory;
private boolean ignoreAnnotations;
private boolean ignoreIdentifiers;
@@ -96,8 +96,8 @@ public void setFormat(String format) {
this.format = format;
}
- public void setIncludeXmlInSite(boolean includeXmlInSite) {
- this.includeXmlInSite = includeXmlInSite;
+ public void setIncludeXmlInReports(boolean includeXmlInReports) {
+ this.includeXmlInReports = includeXmlInReports;
}
public void setReportOutputDirectory(String reportOutputDirectory) {
@@ -148,8 +148,8 @@ public String getFormat() {
return format;
}
- public boolean isIncludeXmlInSite() {
- return includeXmlInSite;
+ public boolean isIncludeXmlInReports() {
+ return includeXmlInReports;
}
public String getReportOutputDirectory() {
diff --git a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
index e6dacdbe..4e93d968 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
@@ -237,7 +237,11 @@ private PmdResult run() throws MavenReportException {
// always write XML report, as this might be needed by the check mojo
// we need to output it even if the file list is empty or we have no violations
// so the "check" goals can check for violations
- writeXmlReport(report);
+ try {
+ writeXmlReport(report);
+ } catch (IOException e) {
+ throw new MavenReportException("Failed to write XML report", e);
+ }
// write any other format except for xml and html. xml has just been produced.
// html format is produced by the maven site formatter. Excluding html here
@@ -245,7 +249,11 @@ private PmdResult run() throws MavenReportException {
// considering the html/css styling
String format = request.getFormat();
if (!"html".equals(format) && !"xml".equals(format)) {
- writeFormattedReport(report);
+ try {
+ writeFormattedReport(report);
+ } catch (IOException e) {
+ throw new MavenReportException("Failed to write formatted " + format + " report", e);
+ }
}
return new PmdResult(new File(request.getTargetDirectory(), "pmd.xml"), request.getOutputEncoding());
@@ -313,29 +321,29 @@ private Report processFilesWithPMD(PMDConfiguration pmdConfiguration, List
* @param report
* @throws MavenReportException
*/
- private void writeXmlReport(Report report) throws MavenReportException {
+ private void writeXmlReport(Report report) throws IOException {
File targetFile = writeReport(report, new XMLRenderer(request.getOutputEncoding()));
- if (request.isIncludeXmlInSite()) {
- File siteDir = new File(request.getReportOutputDirectory());
- siteDir.mkdirs();
- try {
- FileUtils.copyFile(targetFile, new File(siteDir, "pmd.xml"));
- } catch (IOException e) {
- throw new MavenReportException(e.getMessage(), e);
+ if (request.isIncludeXmlInReports()) {
+ File outputDirectory = new File(request.getReportOutputDirectory());
+ if (!outputDirectory.exists() && !outputDirectory.mkdirs()) {
+ throw new IOException("Couldn't create report output directory: " + outputDirectory);
}
+ FileUtils.copyFile(targetFile, new File(outputDirectory, "pmd.xml"));
}
}
- private File writeReport(Report report, Renderer r) throws MavenReportException {
+ private File writeReport(Report report, Renderer r) throws IOException {
if (r == null) {
return null;
}
File targetDir = new File(request.getTargetDirectory());
- targetDir.mkdirs();
+ if (!targetDir.exists() && !targetDir.mkdirs()) {
+ throw new IOException("Couldn't create report target directory: " + targetDir);
+ }
+
String extension = r.defaultFileExtension();
File targetFile = new File(targetDir, "pmd." + extension);
- LOG.debug("Target PMD output file: {}", targetFile);
try (Writer writer = new OutputStreamWriter(new FileOutputStream(targetFile), request.getOutputEncoding())) {
r.setWriter(writer);
r.start();
@@ -344,8 +352,6 @@ private File writeReport(Report report, Renderer r) throws MavenReportException
}
r.end();
r.flush();
- } catch (IOException ioe) {
- throw new MavenReportException(ioe.getMessage(), ioe);
}
return targetFile;
@@ -357,7 +363,7 @@ private File writeReport(Report report, Renderer r) throws MavenReportException
* @param report
* @throws MavenReportException
*/
- private void writeFormattedReport(Report report) throws MavenReportException {
+ private void writeFormattedReport(Report report) throws IOException, MavenReportException {
Renderer renderer = createRenderer(request.getFormat(), request.getOutputEncoding());
writeReport(report, renderer);
}
diff --git a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdRequest.java b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdRequest.java
index 07036577..1982e002 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdRequest.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdRequest.java
@@ -55,7 +55,7 @@ public class PmdRequest implements Serializable {
private String outputEncoding;
private String format;
private String benchmarkOutputLocation;
- private boolean includeXmlInSite;
+ private boolean includeXmlInReports;
private String reportOutputDirectory;
/**
@@ -133,8 +133,8 @@ public void setSkipPmdError(boolean skipPmdError) {
this.skipPmdError = skipPmdError;
}
- public void setIncludeXmlInSite(boolean includeXmlInSite) {
- this.includeXmlInSite = includeXmlInSite;
+ public void setIncludeXmlInReports(boolean includeXmlInReports) {
+ this.includeXmlInReports = includeXmlInReports;
}
public void setReportOutputDirectory(String reportOutputDirectory) {
@@ -213,8 +213,8 @@ public boolean isSkipPmdError() {
return skipPmdError;
}
- public boolean isIncludeXmlInSite() {
- return includeXmlInSite;
+ public boolean isIncludeXmlInReports() {
+ return includeXmlInReports;
}
public String getReportOutputDirectory() {
diff --git a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java b/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
index 18a22597..3c4bfd34 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
@@ -21,9 +21,15 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
+import java.util.Collections;
+import java.util.List;
import java.util.Locale;
+import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.ArtifactStubFactory;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
@@ -110,8 +116,17 @@ protected AbstractPmdReport createReportMojo(String goal, File pluginXmlFile) th
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(repoSession, new LocalRepository(artifactStubFactory.getWorkingDir())));
+ List reactorProjects =
+ mojo.getReactorProjects() != null ? mojo.getReactorProjects() : Collections.emptyList();
+
+ setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution());
setVariableValueToObject(mojo, "session", legacySupport.getSession());
- setVariableValueToObject(mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories());
+ setVariableValueToObject(mojo, "repoSession", legacySupport.getRepositorySession());
+ setVariableValueToObject(mojo, "reactorProjects", reactorProjects);
+ setVariableValueToObject(
+ mojo, "remoteProjectRepositories", mojo.getProject().getRemoteProjectRepositories());
+ setVariableValueToObject(
+ mojo, "siteDirectory", new File(mojo.getProject().getBasedir(), "src/site"));
return mojo;
}
@@ -149,4 +164,22 @@ protected String readFile(File file) throws IOException {
public static boolean lowerCaseContains(String text, String contains) {
return text.toLowerCase(Locale.ROOT).contains(contains.toLowerCase(Locale.ROOT));
}
+
+ private MojoExecution getMockMojoExecution() {
+ MojoDescriptor md = new MojoDescriptor();
+ md.setGoal(getGoal());
+
+ MojoExecution me = new MojoExecution(md);
+
+ PluginDescriptor pd = new PluginDescriptor();
+ Plugin p = new Plugin();
+ p.setGroupId("org.apache.maven.plugins");
+ p.setArtifactId("maven-pmd-plugin");
+ pd.setPlugin(p);
+ md.setPluginDescriptor(pd);
+
+ return me;
+ }
+
+ protected abstract String getGoal();
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java b/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
index 86a2b8a3..4d6ac983 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
@@ -22,7 +22,6 @@
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
-import java.util.Locale;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
@@ -40,7 +39,6 @@ public class CpdReportTest extends AbstractPmdReportTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- Locale.setDefault(Locale.ENGLISH);
FileUtils.deleteDirectory(new File(getBasedir(), "target/test/unit"));
}
@@ -51,7 +49,7 @@ protected void setUp() throws Exception {
*/
public void testDefaultConfiguration() throws Exception {
File generatedReport =
- generateReport("cpd", "default-configuration/cpd-default-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-default-configuration-plugin-config.xml");
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
// check if the CPD files were generated
@@ -72,7 +70,7 @@ public void testDefaultConfiguration() throws Exception {
* @throws Exception
*/
public void testTxtFormat() throws Exception {
- generateReport("cpd", "custom-configuration/cpd-txt-format-configuration-plugin-config.xml");
+ generateReport(getGoal(), "custom-configuration/cpd-txt-format-configuration-plugin-config.xml");
// check if the CPD files were generated
File generatedFile = new File(getBasedir(), "target/test/unit/custom-configuration/target/cpd.xml");
@@ -94,7 +92,8 @@ public void testTxtFormat() throws Exception {
* @throws Exception
*/
public void testCustomConfiguration() throws Exception {
- File generatedReport = generateReport("cpd", "custom-configuration/cpd-custom-configuration-plugin-config.xml");
+ File generatedReport =
+ generateReport(getGoal(), "custom-configuration/cpd-custom-configuration-plugin-config.xml");
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
// check if the CPD files were generated
@@ -120,7 +119,7 @@ public void testInvalidFormat() throws Exception {
try {
File testPom = new File(
getBasedir(), "src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml");
- AbstractPmdReport mojo = createReportMojo("cpd", testPom);
+ AbstractPmdReport mojo = createReportMojo(getGoal(), testPom);
setVariableValueToObject(
mojo, "compileSourceRoots", mojo.getProject().getCompileSourceRoots());
generateReport(mojo, testPom);
@@ -133,7 +132,7 @@ public void testInvalidFormat() throws Exception {
}
public void testWriteNonHtml() throws Exception {
- generateReport("cpd", "default-configuration/cpd-default-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-default-configuration-plugin-config.xml");
// check if the CPD files were generated
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
@@ -151,11 +150,11 @@ public void testWriteNonHtml() throws Exception {
}
/**
- * verify the cpd.xml file is included in the site when requested.
+ * verify the cpd.xml file is included in the reports when requested.
* @throws Exception
*/
- public void testIncludeXmlInSite() throws Exception {
- generateReport("cpd", "default-configuration/cpd-report-include-xml-in-site-plugin-config.xml");
+ public void testIncludeXmlInReports() throws Exception {
+ generateReport(getGoal(), "default-configuration/cpd-report-include-xml-in-reports-config.xml");
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
assertTrue(new File(generatedFile.getAbsolutePath()).exists());
@@ -176,13 +175,13 @@ public void testIncludeXmlInSite() throws Exception {
public void testSkipEmptyReportConfiguration() throws Exception {
// verify the generated files do not exist because PMD was skipped
- File generatedReport = generateReport("cpd", "empty-report/cpd-skip-empty-report-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "empty-report/cpd-skip-empty-report-plugin-config.xml");
assertFalse(new File(generatedReport.getAbsolutePath()).exists());
}
public void testEmptyReportConfiguration() throws Exception {
// verify the generated files do exist, even if there are no violations
- File generatedReport = generateReport("cpd", "empty-report/cpd-empty-report-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "empty-report/cpd-empty-report-plugin-config.xml");
assertTrue(new File(generatedReport.getAbsolutePath()).exists());
String str = readFile(generatedReport);
@@ -195,7 +194,7 @@ public void testCpdEncodingConfiguration() throws Exception {
try {
System.setProperty("file.encoding", "UTF-16");
- generateReport("cpd", "default-configuration/cpd-default-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-default-configuration-plugin-config.xml");
// check if the CPD files were generated
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
@@ -208,7 +207,7 @@ public void testCpdEncodingConfiguration() throws Exception {
}
public void testCpdJavascriptConfiguration() throws Exception {
- generateReport("cpd", "default-configuration/cpd-javascript-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-javascript-plugin-config.xml");
// verify the generated file to exist and violations are reported
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
@@ -219,7 +218,7 @@ public void testCpdJavascriptConfiguration() throws Exception {
}
public void testCpdJspConfiguration() throws Exception {
- generateReport("cpd", "default-configuration/cpd-jsp-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-jsp-plugin-config.xml");
// verify the generated file to exist and violations are reported
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
@@ -230,7 +229,7 @@ public void testCpdJspConfiguration() throws Exception {
}
public void testExclusionsConfiguration() throws Exception {
- generateReport("cpd", "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml");
// verify the generated file to exist and no duplications are reported
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/cpd.xml");
@@ -241,7 +240,8 @@ public void testExclusionsConfiguration() throws Exception {
public void testWithCpdErrors() throws Exception {
try {
- generateReport("cpd", "CpdReportTest/with-cpd-errors/pom.xml");
+ generateReport(getGoal(), "CpdReportTest/with-cpd-errors/pom.xml");
+
fail("MavenReportException must be thrown");
} catch (Exception e) {
assertMavenReportException("There was 1 error while executing CPD", e);
@@ -251,10 +251,13 @@ public void testWithCpdErrors() throws Exception {
}
private static void assertMavenReportException(String expectedMessage, Exception exception) {
- // The maven report exception might be wrapped in a RuntimeException
+ // The MavenReportException might be wrapped in another exception
assertTrue(
"Expected MavenReportException, but was: " + exception,
exception instanceof MavenReportException || exception.getCause() instanceof MavenReportException);
+ if (exception.getCause() instanceof MavenReportException) {
+ exception = (Exception) exception.getCause();
+ }
assertTrue(
"Wrong message: expected: " + expectedMessage + ", but was: " + exception.toString(),
exception.toString().contains(expectedMessage));
@@ -264,4 +267,9 @@ private static void assertLogOutputContains(String expectedMessage) {
String log = CapturingPrintStream.getOutput();
assertTrue("Expected '" + expectedMessage + "' in log, but was:\n" + log, log.contains(expectedMessage));
}
+
+ @Override
+ protected String getGoal() {
+ return "cpd";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java b/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
index 1e28e5ce..18428bfc 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
@@ -36,7 +36,7 @@ public void testDefaultConfiguration() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml");
- final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo("cpd-check", testPom);
+ final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom);
cpdViolationMojo.execute();
fail("MojoFailureException should be thrown.");
@@ -53,7 +53,7 @@ public void testNotFailOnViolation() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/cpd-check-notfailonviolation-plugin-config.xml");
- final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo("cpd-check", testPom);
+ final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom);
cpdViolationMojo.execute();
assertTrue(true);
@@ -64,7 +64,7 @@ public void testException() throws Exception {
final File testPom = new File(
getBasedir(),
"src/test/resources/unit/custom-configuration/pmd-check-exception-test-plugin-config.xml");
- final CpdViolationCheckMojo mojo = (CpdViolationCheckMojo) lookupMojo("cpd-check", testPom);
+ final CpdViolationCheckMojo mojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom);
mojo.execute();
fail("MojoFailureException should be thrown.");
@@ -79,9 +79,14 @@ public void testExclusionsConfiguration() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml");
- final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo("cpd-check", testPom);
+ final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom);
// this call shouldn't throw an exception, as the classes with duplications have been excluded
cpdViolationMojo.execute();
}
+
+ @Override
+ protected String getGoal() {
+ return "cpd-check";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
index 478e5ea9..886e5231 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
@@ -23,13 +23,13 @@
import java.net.ServerSocket;
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import java.util.Locale;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
import net.sourceforge.pmd.renderers.Renderer;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.pmd.exec.PmdExecutor;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.plexus.util.FileUtils;
@@ -46,7 +46,6 @@ public class PmdReportTest extends AbstractPmdReportTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- Locale.setDefault(Locale.ENGLISH);
FileUtils.deleteDirectory(new File(getBasedir(), "target/test/unit"));
}
@@ -84,9 +83,9 @@ public void testDefaultConfiguration() throws Exception {
assertTrue(str.contains("pmd_rules_java_bestpractices.html#unusedprivatefield\">UnusedPrivateField"));
// there should be the section Violations By Priority
- assertTrue(str.contains("Violations By Priority"));
- assertTrue(str.contains("Priority 3"));
- assertTrue(str.contains("Priority 4"));
+ assertTrue(str.contains("Violations By Priority"));
+ assertTrue(str.contains("Priority 3"));
+ assertTrue(str.contains("Priority 4"));
// the file App.java is mentioned 3 times: in prio 3, in prio 4 and in the files section
assertEquals(3, StringUtils.countMatches(str, "def/configuration/App.java"));
@@ -105,8 +104,8 @@ public void testDefaultConfigurationNotRenderRuleViolationPriority() throws Exce
new File(getBasedir(), "src/test/resources/unit/default-configuration/jxr-files"),
new File(getBasedir(), "target/test/unit/default-configuration/target/site"));
- File generatedReport =
- generateReport("pmd", "default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml");
+ File generatedReport = generateReport(
+ getGoal(), "default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
String str = readFile(generatedReport);
@@ -121,7 +120,7 @@ public void testDefaultConfigurationNoRenderViolationsByPriority() throws Except
new File(getBasedir(), "target/test/unit/default-configuration/target/site"));
File generatedReport =
- generateReport("pmd", "default-configuration/pmd-report-no-render-violations-by-priority.xml");
+ generateReport(getGoal(), "default-configuration/pmd-report-no-render-violations-by-priority.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
String str = readFile(generatedReport);
@@ -139,7 +138,7 @@ public void testDefaultConfigurationWithAnalysisCache() throws Exception {
new File(getBasedir(), "src/test/resources/unit/default-configuration/jxr-files"),
new File(getBasedir(), "target/test/unit/pmd-with-analysis-cache-plugin-config/target/site"));
- generateReport("pmd", "default-configuration/pmd-with-analysis-cache-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/pmd-with-analysis-cache-plugin-config.xml");
// check if the PMD analysis cache file has been generated
File cacheFile =
@@ -149,7 +148,7 @@ public void testDefaultConfigurationWithAnalysisCache() throws Exception {
public void testJavascriptConfiguration() throws Exception {
File generatedReport =
- generateReport("pmd", "default-configuration/javascript-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/javascript-configuration-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// check if the PMD files were generated
@@ -180,7 +179,7 @@ public void testFileURL() throws Exception {
File testPom = new File(
getBasedir(), "src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml");
- PmdReport mojo = (PmdReport) createReportMojo("pmd", testPom);
+ PmdReport mojo = (PmdReport) createReportMojo(getGoal(), testPom);
// Additional test case for MPMD-174 (https://issues.apache.org/jira/browse/MPMD-174).
int port = determineFreePort();
@@ -270,7 +269,7 @@ private int determineFreePort() {
* @throws Exception
*/
public void testCustomConfiguration() throws Exception {
- File generatedReport = generateReport("pmd", "custom-configuration/custom-configuration-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "custom-configuration/custom-configuration-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// check the generated files
@@ -307,7 +306,7 @@ public void testCustomConfiguration() throws Exception {
* @throws Exception
*/
public void testSkipConfiguration() throws Exception {
- File generatedReport = generateReport("pmd", "custom-configuration/skip-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "custom-configuration/skip-plugin-config.xml");
assertFalse(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// verify the generated files do not exist because PMD was skipped
@@ -319,17 +318,17 @@ public void testSkipConfiguration() throws Exception {
// the fact, the PMD execution has been skipped, should be logged
String output = CapturingPrintStream.getOutput();
- assertTrue(output.contains("Skipping PMD execution"));
+ assertTrue(output.contains("Skipping org.apache.maven.plugins:maven-pmd-plugin"));
}
public void testSkipEmptyReportConfiguration() throws Exception {
// verify the generated files do not exist because PMD was skipped
- File generatedReport = generateReport("pmd", "empty-report/skip-empty-report-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "empty-report/skip-empty-report-plugin-config.xml");
assertFalse(FileUtils.fileExists(generatedReport.getAbsolutePath()));
}
public void testEmptyReportConfiguration() throws Exception {
- File generatedReport = generateReport("pmd", "empty-report/empty-report-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "empty-report/empty-report-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// verify the generated files do exist, even if there are no violations
@@ -345,7 +344,7 @@ public void testInvalidFormat() throws Exception {
try {
File testPom =
new File(getBasedir(), "src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml");
- AbstractPmdReport mojo = createReportMojo("pmd", testPom);
+ AbstractPmdReport mojo = createReportMojo(getGoal(), testPom);
setVariableValueToObject(
mojo, "compileSourceRoots", mojo.getProject().getCompileSourceRoots());
generateReport(mojo, testPom);
@@ -358,7 +357,7 @@ public void testInvalidFormat() throws Exception {
public void testInvalidTargetJdk() throws Exception {
try {
- generateReport("pmd", "empty-report/invalid-format/invalid-target-jdk-plugin-config.xml");
+ generateReport(getGoal(), "empty-report/invalid-format/invalid-target-jdk-plugin-config.xml");
fail("Must throw MavenReportException.");
} catch (Exception e) {
@@ -367,12 +366,12 @@ public void testInvalidTargetJdk() throws Exception {
}
/**
- * verify the pmd.xml file is included in the site when requested.
+ * verify the pmd.xml file is included in the reports when requested.
* @throws Exception
*/
- public void testIncludeXmlInSite() throws Exception {
+ public void testIncludeXmlInReports() throws Exception {
File generatedReport =
- generateReport("pmd", "default-configuration/pmd-report-include-xml-in-site-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/pmd-report-include-xml-in-reports-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// verify the pmd file is included in site
@@ -396,7 +395,7 @@ public void testLocationTemp() throws Exception {
File testPom = new File(
getBasedir(), "src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml");
- PmdReport mojo = (PmdReport) lookupMojo("pmd", testPom);
+ PmdReport mojo = (PmdReport) lookupMojo(getGoal(), testPom);
assertEquals(
"locationTemp is not correctly encoding filename",
@@ -412,7 +411,8 @@ public void testLocationTemp() throws Exception {
* @throws Exception
*/
public void testSuppressMarkerConfiguration() throws Exception {
- File generatedReport = generateReport("pmd", "default-configuration/pmd-with-suppressMarker-plugin-config.xml");
+ File generatedReport =
+ generateReport(getGoal(), "default-configuration/pmd-with-suppressMarker-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// check if the PMD files were generated
@@ -437,7 +437,7 @@ public void testSuppressMarkerConfiguration() throws Exception {
public void testSuppressMarkerConfigurationWithoutRendering() throws Exception {
File generatedReport =
- generateReport("pmd", "default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// check if the PMD files were generated
@@ -461,7 +461,7 @@ public void testSuppressMarkerConfigurationWithoutRendering() throws Exception {
}
public void testJspConfiguration() throws Exception {
- File generatedReport = generateReport("pmd", "default-configuration/jsp-configuration-plugin-config.xml");
+ File generatedReport = generateReport(getGoal(), "default-configuration/jsp-configuration-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
// check if the PMD files were generated
@@ -497,15 +497,16 @@ public void testJspConfiguration() throws Exception {
public void testPMDProcessingError() throws Exception {
try {
- generateReport("pmd", "processing-error/pmd-processing-error-plugin-config.xml");
+ generateReport(getGoal(), "processing-error/pmd-processing-error-plugin-config.xml");
fail("Expected exception");
- } catch (RuntimeException e) {
- assertTrue(e.getMessage().endsWith("Found 1 PMD processing errors"));
+ } catch (MojoExecutionException e) {
+ assertTrue(e.getCause().getMessage().endsWith("Found 1 PMD processing errors"));
}
}
public void testPMDProcessingErrorWithDetailsSkipped() throws Exception {
- File generatedReport = generateReport("pmd", "processing-error/pmd-processing-error-skip-plugin-config.xml");
+ File generatedReport =
+ generateReport(getGoal(), "processing-error/pmd-processing-error-skip-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
String output = CapturingPrintStream.getOutput();
@@ -526,7 +527,7 @@ public void testPMDProcessingErrorWithDetailsSkipped() throws Exception {
public void testPMDProcessingErrorWithDetailsNoReport() throws Exception {
File generatedReport =
- generateReport("pmd", "processing-error/pmd-processing-error-no-report-plugin-config.xml");
+ generateReport(getGoal(), "processing-error/pmd-processing-error-no-report-plugin-config.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
String output = CapturingPrintStream.getOutput();
@@ -546,7 +547,7 @@ public void testPMDProcessingErrorWithDetailsNoReport() throws Exception {
}
public void testPMDExcludeRootsShouldExcludeSubdirectories() throws Exception {
- generateReport("pmd", "exclude-roots/pmd-exclude-roots-plugin-config.xml");
+ generateReport(getGoal(), "exclude-roots/pmd-exclude-roots-plugin-config.xml");
File generatedFile = new File(getBasedir(), "target/test/unit/exclude-roots/target/pmd.xml");
assertTrue(FileUtils.fileExists(generatedFile.getAbsolutePath()));
@@ -561,7 +562,7 @@ public void testPMDExcludeRootsShouldExcludeSubdirectories() throws Exception {
}
public void testViolationExclusion() throws Exception {
- generateReport("pmd", "default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml");
+ generateReport(getGoal(), "default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml");
File generatedFile = new File(getBasedir(), "target/test/unit/default-configuration/target/pmd.xml");
assertTrue(FileUtils.fileExists(generatedFile.getAbsolutePath()));
@@ -586,13 +587,13 @@ public void testPmdReportCustomRulesNoExternalInfoUrl() throws Exception {
new File(getBasedir(), "src/test/resources/unit/default-configuration/jxr-files"),
new File(getBasedir(), "target/test/unit/default-configuration/target/site"));
- File generatedReport = generateReport("pmd", "default-configuration/pmd-report-custom-rules.xml");
+ File generatedReport = generateReport(getGoal(), "default-configuration/pmd-report-custom-rules.xml");
assertTrue(FileUtils.fileExists(generatedReport.getAbsolutePath()));
String str = readFile(generatedReport);
// custom rule without link
- assertEquals(2, StringUtils.countMatches(str, "CustomRule | "));
+ assertEquals(2, StringUtils.countMatches(str, "CustomRule | "));
// standard rule with link
assertEquals(4, StringUtils.countMatches(str, "\">UnusedPrivateField"));
}
@@ -639,7 +640,7 @@ public void testPmdReportResolveRulesets() throws Exception {
File testPom =
new File(getBasedir(), "src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml");
- PmdReport mojo = (PmdReport) createReportMojo("pmd", testPom);
+ PmdReport mojo = (PmdReport) createReportMojo(getGoal(), testPom);
mojo.rulesets[3] = sonarExportRulesetUrl;
mojo.rulesets[4] = myRulesetUrl;
mojo.rulesets[5] = notAInternalRulesetUrl;
@@ -674,4 +675,9 @@ public void testPmdReportResolveRulesets() throws Exception {
mockServer.stop();
}
+
+ @Override
+ protected String getGoal() {
+ return "pmd";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java
index dff209a5..c54cb6c9 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java
@@ -38,7 +38,7 @@ public void testDefaultConfiguration() throws Exception {
final File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml");
- final PmdViolationCheckMojo mojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo mojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
mojo.execute();
fail("MojoFailureException should be thrown.");
@@ -54,7 +54,7 @@ public void testNotFailOnViolation() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml");
- final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationMojo.execute();
assertTrue(true);
@@ -66,13 +66,13 @@ public void testMaxAllowedViolations() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml");
- final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationMojo.execute();
testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml");
- final PmdViolationCheckMojo pmdViolationMojoFail = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo pmdViolationMojoFail = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
try {
pmdViolationMojoFail.execute();
@@ -90,13 +90,13 @@ public void testFailurePriority() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml");
- PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
pmdViolationMojo.execute();
testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml");
- pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
try {
pmdViolationMojo.execute();
fail("Exception Expected");
@@ -112,7 +112,7 @@ public void testException() throws Exception {
final File testPom = new File(
getBasedir(),
"src/test/resources/unit/custom-configuration/pmd-check-exception-test-plugin-config.xml");
- final PmdViolationCheckMojo mojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo mojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
mojo.execute();
fail("MojoFailureException should be thrown.");
@@ -127,9 +127,14 @@ public void testViolationExclusion() throws Exception {
File testPom = new File(
getBasedir(),
"src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml");
- final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo("check", testPom);
+ final PmdViolationCheckMojo pmdViolationMojo = (PmdViolationCheckMojo) lookupMojo(getGoal(), testPom);
// this call shouldn't throw an exception, as the classes with violations have been excluded
pmdViolationMojo.execute();
}
+
+ @Override
+ protected String getGoal() {
+ return "check";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/stubs/CustomConfigurationMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pmd/stubs/CustomConfigurationMavenProjectStub.java
index 1d892b7f..1d79c445 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/stubs/CustomConfigurationMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/stubs/CustomConfigurationMavenProjectStub.java
@@ -44,8 +44,7 @@ public CustomConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try (InputStream is = new FileInputStream(new File(getBasedir()
- + "/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml"))) {
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
model = pomReader.read(is);
setModel(model);
} catch (Exception e) {
@@ -64,15 +63,15 @@ public CustomConfigurationMavenProjectStub() {
Build build = new Build();
build.setFinalName(model.getBuild().getFinalName());
- build.setDirectory(getBasedir() + "/target/test/unit/custom-configuration/target");
- build.setSourceDirectory(getBasedir() + "/src/test/resources/unit/custom-configuration");
+ build.setDirectory(getBasedir() + "/target");
+ build.setSourceDirectory(getBasedir().getAbsolutePath());
setBuild(build);
setReportPlugins(model.getReporting().getPlugins());
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/custom-configuration/custom/configuration");
+ compileSourceRoots.add(basedir + "/custom/configuration");
setCompileSourceRoots(compileSourceRoots);
Artifact artifact = new PmdPluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging());
@@ -103,4 +102,14 @@ public void setReportPlugins(List plugins) {
public List getReportPlugins() {
return reportPlugins;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/custom-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "custom-configuration-plugin-config.xml";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/stubs/DefaultConfigurationMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pmd/stubs/DefaultConfigurationMavenProjectStub.java
index e02a9a8b..ba1bc727 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/stubs/DefaultConfigurationMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/stubs/DefaultConfigurationMavenProjectStub.java
@@ -44,8 +44,7 @@ public DefaultConfigurationMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try (InputStream is = new FileInputStream(new File(getBasedir()
- + "/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml"))) {
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
model = pomReader.read(is);
setModel(model);
} catch (Exception e) {
@@ -64,15 +63,15 @@ public DefaultConfigurationMavenProjectStub() {
Build build = new Build();
build.setFinalName(model.getBuild().getFinalName());
- build.setDirectory(getBasedir() + "/target/test/unit/default-configuration/target");
- build.setSourceDirectory(getBasedir() + "/src/test/resources/unit/default-configuration");
+ build.setDirectory(getBasedir() + "/target");
+ build.setSourceDirectory(getBasedir().getAbsolutePath());
setBuild(build);
setReportPlugins(model.getReporting().getPlugins());
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/default-configuration/def/configuration");
+ compileSourceRoots.add(basedir + "/def/configuration");
setCompileSourceRoots(compileSourceRoots);
File file = new File(getBasedir().getAbsolutePath() + "/pom.xml");
@@ -104,4 +103,14 @@ public void setBuild(Build build) {
public Build getBuild() {
return build;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/default-configuration");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "default-configuration-plugin-config.xml";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/stubs/InvalidFormatMavenProjectStub.java b/src/test/java/org/apache/maven/plugins/pmd/stubs/InvalidFormatMavenProjectStub.java
index 6e0a86dd..381fff93 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/stubs/InvalidFormatMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/stubs/InvalidFormatMavenProjectStub.java
@@ -41,8 +41,7 @@ public InvalidFormatMavenProjectStub() {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Model model = null;
- try (InputStream is = new FileInputStream(
- new File(getBasedir() + "/src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml"))) {
+ try (InputStream is = new FileInputStream(new File(getBasedir() + "/" + getPOM()))) {
model = pomReader.read(is);
setModel(model);
} catch (Exception e) {
@@ -61,13 +60,13 @@ public InvalidFormatMavenProjectStub() {
Build build = new Build();
build.setFinalName(model.getBuild().getFinalName());
- build.setDirectory(getBasedir() + "/target/test/unit/invalid-format/target");
- build.setSourceDirectory(getBasedir() + "/src/test/resources/unit/invalid-format");
+ build.setDirectory(getBasedir() + "/target");
+ build.setSourceDirectory(getBasedir().getAbsolutePath());
setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add(basedir + "/src/test/resources/unit/invalid-format/invalid/format");
+ compileSourceRoots.add(basedir + "/invalid/format");
setCompileSourceRoots(compileSourceRoots);
Artifact artifact = new PmdPluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging());
@@ -88,4 +87,14 @@ public void setBuild(Build build) {
public Build getBuild() {
return build;
}
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/invalid-format");
+ }
+
+ @Override
+ protected String getPOM() {
+ return "invalid-format-plugin-config.xml";
+ }
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/stubs/PmdProjectStub.java b/src/test/java/org/apache/maven/plugins/pmd/stubs/PmdProjectStub.java
index fd34c4f6..1a0d86f1 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/stubs/PmdProjectStub.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/stubs/PmdProjectStub.java
@@ -18,16 +18,34 @@
*/
package org.apache.maven.plugins.pmd.stubs;
+import java.io.File;
import java.util.Collections;
import java.util.List;
+import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.eclipse.aether.repository.RemoteRepository;
public abstract class PmdProjectStub extends MavenProjectStub {
+ /**
+ * @return the POM file name
+ */
+ protected abstract String getPOM();
+
+ @Override
+ public File getBasedir() {
+ return new File(super.getBasedir() + "/src/test/resources/unit/");
+ }
+
+ @Override
+ public File getFile() {
+ return new File(getBasedir(), getPOM());
+ }
+
@Override
public List getRemoteArtifactRepositories() {
ArtifactRepository repository = new MavenArtifactRepository(
@@ -39,4 +57,9 @@ public List getRemoteArtifactRepositories() {
return Collections.singletonList(repository);
}
+
+ @Override
+ public List getRemoteProjectRepositories() {
+ return RepositoryUtils.toRepos(getRemoteArtifactRepositories());
+ }
}
diff --git a/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml b/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml
index b080ed00..8ace0700 100644
--- a/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml
+++ b/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/CpdReportTest/with-cpd-errors/target/site
${basedir}/target/test/unit/CpdReportTest/with-cpd-errors/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/CpdReportTest/with-cpd-errors/target/site/xref
diff --git a/src/test/resources/unit/custom-configuration/cpd-custom-configuration-plugin-config.xml b/src/test/resources/unit/custom-configuration/cpd-custom-configuration-plugin-config.xml
index 35955898..6fd8a79e 100644
--- a/src/test/resources/unit/custom-configuration/cpd-custom-configuration-plugin-config.xml
+++ b/src/test/resources/unit/custom-configuration/cpd-custom-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/custom-configuration/target/site
${basedir}/target/test/unit/custom-configuration/target
- ${localRepository}
csv
false
${basedir}/target/test/unit/custom-configuration/target/site/xref
diff --git a/src/test/resources/unit/custom-configuration/cpd-txt-format-configuration-plugin-config.xml b/src/test/resources/unit/custom-configuration/cpd-txt-format-configuration-plugin-config.xml
index eb7d1fe3..ffc29032 100644
--- a/src/test/resources/unit/custom-configuration/cpd-txt-format-configuration-plugin-config.xml
+++ b/src/test/resources/unit/custom-configuration/cpd-txt-format-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/custom-configuration/target/site
${basedir}/target/test/unit/custom-configuration/target
- ${localRepository}
txt
false
30
diff --git a/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml b/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml
index 8cfd6ef5..d1ff3f43 100644
--- a/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml
+++ b/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/custom-configuration/target/site
${basedir}/target/test/unit/custom-configuration/target
- ${localRepository}
${basedir}/target/test/unit/custom-configuration/target/pmd/rulesets
csv
true
diff --git a/src/test/resources/unit/default-configuration/cpd-default-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/cpd-default-configuration-plugin-config.xml
index e57fe5d3..a201c3ee 100644
--- a/src/test/resources/unit/default-configuration/cpd-default-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/cpd-default-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/default-configuration/target/site/xref
diff --git a/src/test/resources/unit/default-configuration/cpd-javascript-plugin-config.xml b/src/test/resources/unit/default-configuration/cpd-javascript-plugin-config.xml
index f7e045ad..089fb484 100644
--- a/src/test/resources/unit/default-configuration/cpd-javascript-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/cpd-javascript-plugin-config.xml
@@ -35,7 +35,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/default-configuration/target/site/xref
diff --git a/src/test/resources/unit/default-configuration/cpd-jsp-plugin-config.xml b/src/test/resources/unit/default-configuration/cpd-jsp-plugin-config.xml
index 6ad62d0b..3cb44b30 100644
--- a/src/test/resources/unit/default-configuration/cpd-jsp-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/cpd-jsp-plugin-config.xml
@@ -35,7 +35,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/default-configuration/target/site/xref
diff --git a/src/test/resources/unit/default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml
index 85ea1918..76efc020 100644
--- a/src/test/resources/unit/default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/default-configuration/target/site/xref
diff --git a/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-site-plugin-config.xml b/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
similarity index 94%
rename from src/test/resources/unit/default-configuration/cpd-report-include-xml-in-site-plugin-config.xml
rename to src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
index 7920f0a4..afe562b1 100644
--- a/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-site-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
@@ -24,7 +24,7 @@ under the License.
jar
1.0-SNAPSHOT
2006
- Maven CPD Plugin Default Configuration Test With includeXmlInSite
+ Maven CPD Plugin Default Configuration Test With includeXmlInReports
http://maven.apache.org
default-configuration
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
xml
false
${basedir}/target/test/unit/default-configuration/target/site/xref
@@ -45,7 +44,7 @@ under the License.
${basedir}/src/test/resources/unit/default-configuration/
UTF-8
- true
+ true
xml
diff --git a/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
index 36e22ec5..fb99dbf1 100644
--- a/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/javascript-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/javascript-configuration-plugin-config.xml
index 24457540..791540f1 100644
--- a/src/test/resources/unit/default-configuration/javascript-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/javascript-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
UTF-8
diff --git a/src/test/resources/unit/default-configuration/jsp-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/jsp-configuration-plugin-config.xml
index 0de51597..a0fa7f44 100644
--- a/src/test/resources/unit/default-configuration/jsp-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/jsp-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
UTF-8
diff --git a/src/test/resources/unit/default-configuration/pmd-report-custom-rules.xml b/src/test/resources/unit/default-configuration/pmd-report-custom-rules.xml
index b5f9c4dd..c737e21c 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-custom-rules.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-custom-rules.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
${basedir}/src/test/resources/unit/default-configuration/rulesets/custom-rules.xml
diff --git a/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-site-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
similarity index 95%
rename from src/test/resources/unit/default-configuration/pmd-report-include-xml-in-site-plugin-config.xml
rename to src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
index e62b70ce..88e269bf 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-site-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
@@ -36,11 +36,10 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
UTF-8
- true
+ true
diff --git a/src/test/resources/unit/default-configuration/pmd-report-no-render-violations-by-priority.xml b/src/test/resources/unit/default-configuration/pmd-report-no-render-violations-by-priority.xml
index a9db808a..9194f6f9 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-no-render-violations-by-priority.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-no-render-violations-by-priority.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml
index f2633ce2..572a5e1e 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml
index 246d4952..3387d3ed 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml b/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
index ba37dd30..b03474bb 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
${basedir}/src/test/resources/unit/default-configuration/rulesets/custom-rules.xml
diff --git a/src/test/resources/unit/default-configuration/pmd-with-analysis-cache-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-with-analysis-cache-plugin-config.xml
index df2c0f19..642f124e 100644
--- a/src/test/resources/unit/default-configuration/pmd-with-analysis-cache-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-with-analysis-cache-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/pmd-with-analysis-cache-plugin-config/target/site
${basedir}/target/test/unit/pmd-with-analysis-cache-plugin-config/target
- ${localRepository}
${basedir}/target/test/unit/pmd-with-analysis-cache-plugin-config/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml
index 9ed62576..d3889696 100644
--- a/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-plugin-config.xml b/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-plugin-config.xml
index c5116dd9..efd85233 100644
--- a/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-plugin-config.xml
+++ b/src/test/resources/unit/default-configuration/pmd-with-suppressMarker-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/default-configuration/target/site
${basedir}/target/test/unit/default-configuration/target
- ${localRepository}
${basedir}/target/test/unit/default-configuration/target/pmd/rulesets
xml
true
diff --git a/src/test/resources/unit/empty-report/cpd-empty-report-plugin-config.xml b/src/test/resources/unit/empty-report/cpd-empty-report-plugin-config.xml
index be2b5348..e0001ecb 100644
--- a/src/test/resources/unit/empty-report/cpd-empty-report-plugin-config.xml
+++ b/src/test/resources/unit/empty-report/cpd-empty-report-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/empty-report/target/site
${basedir}/target/test/unit/empty-report/target
- ${localRepository}
${basedir}/src/test/resources/unit/empty-report/java/
diff --git a/src/test/resources/unit/empty-report/empty-report-plugin-config.xml b/src/test/resources/unit/empty-report/empty-report-plugin-config.xml
index c1c6ea8e..00c24f08 100644
--- a/src/test/resources/unit/empty-report/empty-report-plugin-config.xml
+++ b/src/test/resources/unit/empty-report/empty-report-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/empty-report/target/site
${basedir}/target/test/unit/empty-report/target
- ${localRepository}
${basedir}/target/test/unit/empty-report/target/pmd/rulesets
${basedir}/src/test/resources/unit/empty-report/java/
diff --git a/src/test/resources/unit/exclude-roots/pmd-exclude-roots-plugin-config.xml b/src/test/resources/unit/exclude-roots/pmd-exclude-roots-plugin-config.xml
index ac800c73..bec142fe 100644
--- a/src/test/resources/unit/exclude-roots/pmd-exclude-roots-plugin-config.xml
+++ b/src/test/resources/unit/exclude-roots/pmd-exclude-roots-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/exclude-roots/target/site
${basedir}/target/test/unit/exclude-roots/target
- ${localRepository}
${basedir}/target/test/unit/exclude-roots/target/pmd/rulesets
xml
UTF-8
diff --git a/src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml b/src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml
index 77ec9401..8393c5e2 100644
--- a/src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml
+++ b/src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/invalid-format/target/site
${basedir}/target/test/unit/invalid-format/target
- ${localRepository}
xhtml
false
${basedir}/target/test/unit/invalid-format/target/site/xref
diff --git a/src/test/resources/unit/processing-error/pmd-processing-error-no-report-plugin-config.xml b/src/test/resources/unit/processing-error/pmd-processing-error-no-report-plugin-config.xml
index ba7f86f9..40f087f2 100644
--- a/src/test/resources/unit/processing-error/pmd-processing-error-no-report-plugin-config.xml
+++ b/src/test/resources/unit/processing-error/pmd-processing-error-no-report-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/parse-error/target/site
${basedir}/target/test/unit/parse-error/target
- ${localRepository}
${basedir}/target/test/unit/parse-error/target/pmd/rulesets
xml
UTF-8
diff --git a/src/test/resources/unit/processing-error/pmd-processing-error-skip-plugin-config.xml b/src/test/resources/unit/processing-error/pmd-processing-error-skip-plugin-config.xml
index 686d7052..55c8a4d9 100644
--- a/src/test/resources/unit/processing-error/pmd-processing-error-skip-plugin-config.xml
+++ b/src/test/resources/unit/processing-error/pmd-processing-error-skip-plugin-config.xml
@@ -36,7 +36,6 @@ under the License.
${basedir}/target/test/unit/parse-error/target/site
${basedir}/target/test/unit/parse-error/target
- ${localRepository}
${basedir}/target/test/unit/parse-error/target/pmd/rulesets
xml
UTF-8