This is an automated email from the ASF dual-hosted git repository.

sparsick pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f049b7  chore: migrate junit 3/4 tests to junit 5 (#675)
6f049b7 is described below

commit 6f049b7950f2157d0d11093ae943b70a8049764a
Author: Sandra Parsick <[email protected]>
AuthorDate: Sat Dec 20 07:46:03 2025 +0000

    chore: migrate junit 3/4 tests to junit 5 (#675)
    
    
    Signed-off-by: Sandra Parsick <[email protected]>
    Co-authored-by: Slawomir Jaranowski <[email protected]>
---
 pom.xml                                            |  13 +-
 .../plugins/pmd/AbstractPmdReportTestCase.java     | 160 --------
 .../apache/maven/plugins/pmd/CpdReportTest.java    | 238 ++++++++---
 .../plugins/pmd/CpdViolationCheckMojoTest.java     |  81 ++--
 .../apache/maven/plugins/pmd/PmdReportTest.java    | 437 +++++++++++++++------
 .../pmd/PmdViolationCheckMojoOnLinuxTest.java      | 144 +++++++
 .../pmd/PmdViolationCheckMojoOnWindowsTest.java    | 143 +++++++
 .../plugins/pmd/PmdViolationCheckMojoTest.java     | 138 -------
 .../maven/plugins/pmd/exec/ExecutorTest.java       |  10 +-
 .../maven/plugins/pmd/stubs/PmdProjectStub.java    |   4 +-
 .../unit/CpdReportTest/with-cpd-errors/pom.xml     |   2 +-
 .../cpd-custom-configuration-plugin-config.xml     |   2 +-
 .../cpd-txt-format-configuration-plugin-config.xml |   2 +-
 .../custom-configuration-plugin-config.xml         |   4 +-
 .../custom-configuration/skip-plugin-config.xml    |   3 +
 ...-cpd-exclusions-configuration-plugin-config.xml |   2 +-
 .../cpd-default-configuration-plugin-config.xml    |   2 +-
 .../cpd-encoding-configuration-plugin-config.xml   |   2 +-
 .../cpd-javascript-plugin-config.xml               |   2 +-
 .../cpd-jsp-plugin-config.xml                      |   2 +-
 ...-cpd-exclusions-configuration-plugin-config.xml |   4 +-
 .../cpd-report-include-xml-in-reports-config.xml   |   2 +-
 .../cpd-report-windows/cpd.xml                     |  78 ++++
 .../unit/default-configuration/cpd-report/cpd.xml  |  78 ++++
 .../default-configuration-plugin-config.xml        |   2 +-
 .../excludes/my-exclude-cpd.properties             |  19 +
 .../excludes/pmd_exclude.properties                |  21 +
 .../javascript-configuration-plugin-config.xml     |   2 +-
 .../jsp-configuration-plugin-config.xml            |   2 +-
 ...d-check-default-configuration-plugin-config.xml |   3 +
 ...d-check-failandwarnonpriority-plugin-config.xml |   3 +
 .../pmd-check-failmaxviolation-plugin-config.xml   |   3 +
 .../pmd-check-failonpriority-plugin-config.xml     |   3 +
 ...pmd-check-notfailmaxviolation-plugin-config.xml |   3 +
 .../pmd-check-notfailonviolation-plugin-config.xml |   3 +
 ...-pmd-exclusions-configuration-plugin-config.xml |   5 +-
 .../pmd-report-custom-rules.xml                    |   8 +-
 .../pmd-report-include-xml-in-reports-config.xml   |   3 +
 ...pmd-report-no-render-violations-by-priority.xml |   2 +-
 ...port-not-render-rule-priority-plugin-config.xml |   2 +-
 ...-pmd-exclusions-configuration-plugin-config.xml |   4 +-
 .../pmd-report-resolve-rulesets.xml                |   4 +-
 .../pmd-report-windows/pmd.xml                     |  51 +++
 .../unit/default-configuration/pmd-report/pmd.xml  |  51 +++
 .../pmd-with-analysis-cache-plugin-config.xml      |   2 +-
 ...with-suppressMarker-no-render-plugin-config.xml |   2 +-
 .../pmd-with-suppressMarker-plugin-config.xml      |   2 +-
 .../cpd-skip-empty-report-plugin-config.xml        |   6 +-
 .../skip-empty-report-plugin-config.xml            |   8 +-
 .../pmd-exclude-roots-plugin-config.xml            |  12 +-
 .../cpd-invalid-format-plugin-config.xml           |   1 +
 .../invalid-format-plugin-config.xml               |   3 +
 ...md-processing-error-no-report-plugin-config.xml |   2 +-
 .../pmd-processing-error-plugin-config.xml         |   2 +-
 .../pmd-processing-error-skip-plugin-config.xml    |   2 +-
 55 files changed, 1222 insertions(+), 567 deletions(-)

diff --git a/pom.xml b/pom.xml
index ea23bce..373c39d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -231,16 +231,10 @@ under the License.
     </dependency>
 
     <!-- test -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
-      <version>4.0.0-alpha-2</version>
+      <version>3.4.0</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -285,6 +279,11 @@ under the License.
       <version>2.21.0</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
diff --git 
a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java 
b/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
deleted file mode 100644
index 6d2fa96..0000000
--- a/src/test/java/org/apache/maven/plugins/pmd/AbstractPmdReportTestCase.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.pmd;
-
-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.execution.MavenSession;
-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;
-import org.apache.maven.project.DefaultProjectBuildingRequest;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingRequest;
-import org.apache.maven.session.scope.internal.SessionScope;
-import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
-import org.eclipse.aether.repository.LocalRepository;
-
-/**
- * @author <a href="mailto:[email protected]";>Vincent Siveton</a>
- * @version $Id$
- * @since 2.5
- */
-public abstract class AbstractPmdReportTestCase extends AbstractMojoTestCase {
-    private ArtifactStubFactory artifactStubFactory;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        CapturingPrintStream.init(true);
-
-        artifactStubFactory = new 
DependencyArtifactStubFactory(getTestFile("target"), true, false);
-        artifactStubFactory.getWorkingDir().mkdirs();
-        SessionScope sessionScope = lookup(SessionScope.class);
-        sessionScope.enter();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        SessionScope lookup = lookup(SessionScope.class);
-        lookup.exit();
-        super.tearDown();
-    }
-
-    /**
-     * Generate the report and return the generated file.
-     *
-     * @param goal the mojo goal
-     * @param pluginXml the name of the xml file in 
"src/test/resources/plugin-configs/"
-     * @return the generated HTML file
-     * @throws Exception if any
-     */
-    protected File generateReport(String goal, String pluginXml) throws 
Exception {
-        File pluginXmlFile = new File(getBasedir(), "src/test/resources/unit/" 
+ pluginXml);
-        AbstractPmdReport mojo = createReportMojo(goal, pluginXmlFile);
-        return generateReport(mojo, pluginXmlFile);
-    }
-
-    protected AbstractPmdReport createReportMojo(String goal, File 
pluginXmlFile) throws Exception {
-        AbstractPmdReport mojo = lookupMojo(goal, pluginXmlFile);
-        assertNotNull("Mojo not found.", mojo);
-
-        SessionScope sessionScope = lookup(SessionScope.class);
-        MavenSession mavenSession = newMavenSession(new MavenProjectStub());
-        sessionScope.seed(MavenSession.class, mavenSession);
-
-        DefaultRepositorySystemSession repositorySession =
-                (DefaultRepositorySystemSession) 
mavenSession.getRepositorySession();
-        repositorySession.setLocalRepositoryManager(new 
SimpleLocalRepositoryManagerFactory()
-                .newInstance(repositorySession, new 
LocalRepository(artifactStubFactory.getWorkingDir())));
-
-        List<MavenProject> reactorProjects =
-                mojo.getReactorProjects() != null ? mojo.getReactorProjects() 
: Collections.emptyList();
-
-        setVariableValueToObject(mojo, "mojoExecution", 
getMockMojoExecution());
-        setVariableValueToObject(mojo, "session", mavenSession);
-        setVariableValueToObject(mojo, "repoSession", repositorySession);
-        setVariableValueToObject(mojo, "reactorProjects", reactorProjects);
-        setVariableValueToObject(
-                mojo, "remoteProjectRepositories", 
mojo.getProject().getRemoteProjectRepositories());
-        setVariableValueToObject(
-                mojo, "siteDirectory", new 
File(mojo.getProject().getBasedir(), "src/site"));
-        return mojo;
-    }
-
-    protected File generateReport(AbstractPmdReport mojo, File pluginXmlFile) 
throws Exception {
-        mojo.execute();
-
-        ProjectBuildingRequest buildingRequest = new 
DefaultProjectBuildingRequest();
-        
buildingRequest.setRepositorySession(lookup(LegacySupport.class).getRepositorySession());
-
-        File outputDir = mojo.getReportOutputDirectory();
-        String filename = mojo.getOutputPath() + ".html";
-
-        return new File(outputDir, filename);
-    }
-
-    /**
-     * Read the contents of the specified file into a string.
-     */
-    protected String readFile(File file) throws IOException {
-        return new String(Files.readAllBytes(file.toPath()));
-    }
-
-    /**
-     * Checks whether the string <code>contained</code> is contained in
-     * the given <code>text</code>, ignoring case.
-     *
-     * @param text the string in which the search is executed
-     * @param contains the string to be searched for
-     * @return <code>true</code> if the text contains the string, otherwise 
<code>false</code>
-     */
-    public static boolean lowerCaseContains(String text, String contains) {
-        return 
text.toLowerCase(Locale.ROOT).contains(contains.toLowerCase(Locale.ROOT));
-    }
-
-    private MojoExecution getMockMojoExecution() {
-        MojoDescriptor mojoDescriptor = new MojoDescriptor();
-        mojoDescriptor.setGoal(getGoal());
-
-        MojoExecution execution = new MojoExecution(mojoDescriptor);
-
-        PluginDescriptor pluginDescriptor = new PluginDescriptor();
-        Plugin plugin = new Plugin();
-        plugin.setGroupId("org.apache.maven.plugins");
-        plugin.setArtifactId("maven-pmd-plugin");
-        pluginDescriptor.setPlugin(plugin);
-        mojoDescriptor.setPluginDescriptor(pluginDescriptor);
-
-        return execution;
-    }
-
-    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 bfd5fd2..37fae72 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdReportTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.maven.plugins.pmd;
 
+import javax.inject.Inject;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
@@ -27,33 +28,107 @@ import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.Locale;
 
-import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.plexus.testing.PlexusExtension;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
 import org.w3c.dom.Document;
 
+import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
 /**
  * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
  * @version $Id$
  */
-public class CpdReportTest extends AbstractPmdReportTestCase {
+@MojoTest
+public class CpdReportTest {
+
+    @Inject
+    private MavenSession mavenSession;
+
+    @Inject
+    private DefaultRepositorySystemSessionFactory repoSessionFactory;
+
+    @Inject
+    private MavenProject testMavenProject;
+
+    @Inject
+    private MojoExecution mojoExecution;
+
+    /**
+     * Checks whether the string <code>contained</code> is contained in
+     * the given <code>text</code>, ignoring case.
+     *
+     * @param text the string in which the search is executed
+     * @param contains the string to be searched for
+     * @return <code>true</code> if the text contains the string, otherwise 
<code>false</code>
+     */
+    public static boolean lowerCaseContains(String text, String contains) {
+        return 
text.toLowerCase(Locale.ROOT).contains(contains.toLowerCase(Locale.ROOT));
+    }
+
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        FileUtils.deleteDirectory(new File(getBasedir(), "target/test/unit"));
+    @BeforeEach
+    public void setUp() {
+        ArtifactRepository localRepo = Mockito.mock(ArtifactRepository.class);
+        Mockito.when(localRepo.getBasedir())
+                .thenReturn(new File(PlexusExtension.getBasedir(), 
"target/local-repo").getAbsolutePath());
+
+        MavenExecutionRequest request = new DefaultMavenExecutionRequest();
+        request.setLocalRepository(localRepo);
+
+        RemoteRepository centralRepo =
+                new RemoteRepository.Builder("central", "default", 
"https://repo.maven.apache.org/maven2";).build();
+
+        DefaultRepositorySystemSession systemSession = 
repoSessionFactory.newRepositorySession(request);
+        
Mockito.when(mavenSession.getRepositorySession()).thenReturn(systemSession);
+        Mockito.when(testMavenProject.getRemoteProjectRepositories())
+                .thenReturn(Collections.singletonList(centralRepo));
+
+        Mockito.when(mojoExecution.getPlugin()).thenReturn(new Plugin());
     }
 
     /**
      * Test CPDReport given the default configuration
      */
-    public void testDefaultConfiguration() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/cpd-default-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testDefaultConfiguration(CpdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(new File(generatedReport.getAbsolutePath()).exists());
 
         // check if the CPD files were generated
@@ -69,10 +144,14 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
     }
 
     /**
-     * Test CPDReport with the text renderer given as "format=txt"
-     */
-    public void testTxtFormat() throws Exception {
-        generateReport(getGoal(), 
"custom-configuration/cpd-txt-format-configuration-plugin-config.xml");
+     * //     * Test CPDReport with the text renderer given as "format=txt"
+     * //     */
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-txt-format-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testTxtFormat(CpdReport mojo) throws Exception {
+        mojo.execute();
 
         // check if the CPD files were generated
         File xmlFile = new File(getBasedir(), 
"target/test/unit/custom-configuration/target/cpd.xml");
@@ -91,9 +170,17 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
     /**
      * Test CpdReport using custom configuration
      */
-    public void testCustomConfiguration() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"custom-configuration/cpd-custom-configuration-plugin-config.xml");
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-custom-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testCustomConfiguration(CpdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the CPD files were generated
@@ -113,24 +200,27 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
     /**
      * Test CPDReport with invalid format
      */
-    public void testInvalidFormat() throws Exception {
+    @Basedir("/unit/invalid-format")
+    @InjectMojo(goal = "cpd", pom = "cpd-invalid-format-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testInvalidFormat(CpdReport mojo) throws 
MojoExecutionException {
         try {
-            File testPom = new File(
-                    getBasedir(), 
"src/test/resources/unit/invalid-format/cpd-invalid-format-plugin-config.xml");
-            AbstractPmdReport mojo = createReportMojo(getGoal(), testPom);
-            setVariableValueToObject(
-                    mojo, "compileSourceRoots", 
mojo.getProject().getCompileSourceRoots());
-            generateReport(mojo, testPom);
-
-            // TODO this should be a more specific subclass
+            mojo.execute();
+
+            // TODO should have more specific exception
             fail("RuntimeException must be thrown");
         } catch (RuntimeException e) {
             assertMavenReportException("Can't find CPD custom format xhtml", 
e);
         }
     }
 
-    public void testWriteNonHtml() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/cpd-default-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testWriteNonHtml(CpdReport mojo) throws Exception {
+        mojo.execute();
 
         // check if the CPD files were generated
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
@@ -152,8 +242,12 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
      *
      * @throws Exception
      */
-    public void testIncludeXmlInReports() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/cpd-report-include-xml-in-reports-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-report-include-xml-in-reports-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testIncludeXmlInReports(CpdReport mojo) throws Exception {
+        mojo.execute();
 
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
         assertTrue(generatedFile.exists());
@@ -172,30 +266,50 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         assertEquals(str, siteReportContent);
     }
 
-    public void testSkipEmptyReportConfiguration() throws Exception {
-        // verify the generated files do not exist because PMD was skipped
-        File generatedReport = generateReport(getGoal(), 
"empty-report/cpd-skip-empty-report-plugin-config.xml");
+    @Basedir("/unit/empty-report")
+    @InjectMojo(goal = "cpd", pom = "cpd-skip-empty-report-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testSkipEmptyReportConfiguration(CpdReport mojo) throws 
Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         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(getGoal(), 
"empty-report/cpd-empty-report-plugin-config.xml");
+    @Basedir("/unit/empty-report")
+    @InjectMojo(goal = "cpd", pom = "cpd-empty-report-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testEmptyReportConfiguration(CpdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(
-                generatedReport.getAbsolutePath() + " does not exist",
-                new File(generatedReport.getAbsolutePath()).exists());
+                new File(generatedReport.getAbsolutePath()).exists(),
+                generatedReport.getAbsolutePath() + " does not exist");
 
         String str = readFile(generatedReport);
         assertFalse(lowerCaseContains(str, "Hello.java"));
         assertTrue(str.contains("CPD found no problems in your source code."));
     }
 
-    public void testCpdEncodingConfiguration() throws Exception {
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testCpdEncodingConfiguration(CpdReport mojo) throws Exception {
         String originalEncoding = System.getProperty("file.encoding");
         try {
             System.setProperty("file.encoding", "UTF-16");
 
-            generateReport(getGoal(), 
"default-configuration/cpd-default-configuration-plugin-config.xml");
+            mojo.execute();
 
             // check if the CPD files were generated
             File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
@@ -207,8 +321,12 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         }
     }
 
-    public void testCpdJavascriptConfiguration() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/cpd-javascript-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = "cpd-javascript-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testCpdJavascriptConfiguration(CpdReport mojo) throws 
Exception {
+        mojo.execute();
 
         // verify the generated file exists and violations are reported
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
@@ -218,8 +336,12 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(lowerCaseContains(str, "SampleDup.js"));
     }
 
-    public void testCpdJspConfiguration() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/cpd-jsp-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = "cpd-jsp-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testCpdJspConfiguration(CpdReport mojo) throws Exception {
+        mojo.execute();
 
         // verify the generated file exists and violations are reported
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
@@ -229,8 +351,12 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(lowerCaseContains(str, "sampleDup.jsp"));
     }
 
-    public void testExclusionsConfiguration() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/cpd-report-cpd-exclusions-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd", pom = 
"cpd-report-cpd-exclusions-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testExclusionsConfiguration(CpdReport mojo) throws Exception {
+        mojo.execute();
 
         // verify the generated file exists and no duplications are reported
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/cpd.xml");
@@ -239,9 +365,13 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         assertEquals(0, StringUtils.countMatches(str, "<duplication"));
     }
 
-    public void testWithCpdErrors() throws Exception {
+    @Basedir("/unit/CpdReportTest")
+    @InjectMojo(goal = "cpd", pom = "with-cpd-errors/pom.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testWithCpdErrors(CpdReport mojo) throws Exception {
         try {
-            generateReport(getGoal(), "CpdReportTest/with-cpd-errors/pom.xml");
+            mojo.execute();
 
             fail("MojoExecutionException must be thrown");
         } catch (MojoExecutionException e) {
@@ -255,8 +385,8 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         MavenReportException cause = (MavenReportException) 
exception.getCause();
         String message = cause.getMessage();
         assertTrue(
-                "Wrong message: expected: " + expectedMessage + ", but was: " 
+ message,
-                message.contains(expectedMessage));
+                message.contains(expectedMessage),
+                "Wrong message: expected: " + expectedMessage + ", but was: " 
+ message);
     }
 
     private static void assertReportContains(String expectedMessage) throws 
IOException {
@@ -264,11 +394,13 @@ public class CpdReportTest extends 
AbstractPmdReportTestCase {
         String report = new String(Files.readAllBytes(path), 
StandardCharsets.UTF_8);
 
         assertTrue(
-                "Expected '" + expectedMessage + "' in cpd.xml, but was:\n" + 
report, report.contains(expectedMessage));
+                report.contains(expectedMessage), "Expected '" + 
expectedMessage + "' in cpd.xml, but was:\n" + report);
     }
 
-    @Override
-    protected String getGoal() {
-        return "cpd";
+    /**
+     * Read the contents of the specified file into a string.
+     */
+    protected String readFile(File file) throws IOException {
+        return new String(Files.readAllBytes(file.toPath()));
     }
 }
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 8622a5a..f0570f5 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
@@ -18,26 +18,32 @@
  */
 package org.apache.maven.plugins.pmd;
 
-import java.io.File;
-
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
  * @version $Id$
  */
-public class CpdViolationCheckMojoTest extends AbstractPmdReportTestCase {
-
-    public void testDefaultConfiguration() throws Exception {
-        generateReport("cpd", 
"default-configuration/cpd-default-configuration-plugin-config.xml");
+@MojoTest
+public class CpdViolationCheckMojoTest {
 
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd-check", pom = 
"cpd-check-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "cpd-report")
+    @Test
+    public void testDefaultConfiguration(CpdViolationCheckMojo mojo) throws 
Exception {
         try {
-            File testPom = new File(
-                    getBasedir(),
-                    
"src/test/resources/unit/default-configuration/cpd-check-default-configuration-plugin-config.xml");
-            CpdViolationCheckMojo cpdViolationCheckMojo = 
lookupMojo(getGoal(), testPom);
-            cpdViolationCheckMojo.execute();
+            mojo.execute();
 
             fail("MojoFailureException should be thrown.");
         } catch (final MojoFailureException e) {
@@ -45,45 +51,38 @@ public class CpdViolationCheckMojoTest extends 
AbstractPmdReportTestCase {
         }
     }
 
-    public void testNotFailOnViolation() throws Exception {
-        generateReport("cpd", 
"default-configuration/cpd-default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/cpd-check-notfailonviolation-plugin-config.xml");
-        CpdViolationCheckMojo cpdViolationCheckMojo = lookupMojo(getGoal(), 
testPom);
-        cpdViolationCheckMojo.execute();
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd-check", pom = 
"cpd-check-notfailonviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "cpd-report")
+    @Test
+    public void testNotFailOnViolation(CpdViolationCheckMojo mojo) throws 
Exception {
+        mojo.execute();
     }
 
-    public void testException() throws Exception {
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "cpd-check", pom = 
"cpd-check-exception-test-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "cpd-report")
+    @Test
+    public void testException(CpdViolationCheckMojo mojo) throws Exception {
         try {
-            File testPom = new File(
-                    getBasedir(),
-                    
"src/test/resources/unit/custom-configuration/cpd-check-exception-test-plugin-config.xml");
-            CpdViolationCheckMojo cpdViolationCheckMojo = 
lookupMojo(getGoal(), testPom);
-            cpdViolationCheckMojo.project = new MavenProject();
-            cpdViolationCheckMojo.execute();
+            mojo.project = new MavenProject();
+            mojo.execute();
 
             fail("MojoFailureException should be thrown.");
         } catch (MojoFailureException e) {
-            assertNotNull(e.getMessage());
+            assertTrue(e.getMessage().contains("Unable to perform check"));
         }
     }
 
-    public void testExclusionsConfiguration() throws Exception {
-        generateReport("cpd", 
"default-configuration/cpd-default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml");
-        CpdViolationCheckMojo cpdViolationCheckMojo = lookupMojo(getGoal(), 
testPom);
-
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "cpd-check", pom = 
"cpd-check-cpd-exclusions-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "cpd-report")
+    @Test
+    public void testExclusionsConfiguration(CpdViolationCheckMojo mojo) throws 
Exception {
         // this call shouldn't throw an exception, as the classes with 
duplications have been excluded
-        cpdViolationCheckMojo.execute();
-    }
-
-    @Override
-    protected String getGoal() {
-        return "cpd-check";
+        mojo.execute();
     }
 }
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 8cfdd84..66a6174 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
@@ -18,43 +18,121 @@
  */
 package org.apache.maven.plugins.pmd;
 
+import javax.inject.Inject;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.ServerSocket;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Collections;
+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.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.execution.DefaultMavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.pmd.exec.PmdExecutor;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.MavenReportException;
-import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.testing.PlexusExtension;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
  * @version $Id$
  */
-public class PmdReportTest extends AbstractPmdReportTestCase {
+@MojoTest
+public class PmdReportTest {
+
+    @Inject
+    private MavenSession mavenSession;
+
+    @Inject
+    private DefaultRepositorySystemSessionFactory repoSessionFactory;
+
+    @Inject
+    private MavenProject testMavenProject;
+
+    @Inject
+    private MojoExecution mojoExecution;
+
+    /**
+     * Checks whether the string <code>contained</code> is contained in
+     * the given <code>text</code>, ignoring case.
+     *
+     * @param text the string in which the search is executed
+     * @param contains the string to be searched for
+     * @return <code>true</code> if the text contains the string, otherwise 
<code>false</code>
+     */
+    public static boolean lowerCaseContains(String text, String contains) {
+        return 
text.toLowerCase(Locale.ROOT).contains(contains.toLowerCase(Locale.ROOT));
+    }
 
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        org.apache.commons.io.FileUtils.deleteDirectory(new File(getBasedir(), 
"target/test/unit"));
+    @BeforeEach
+    public void setUp() throws Exception {
+        CapturingPrintStream.init(true);
+        ArtifactRepository localRepo = Mockito.mock(ArtifactRepository.class);
+        Mockito.when(localRepo.getBasedir())
+                .thenReturn(new File(PlexusExtension.getBasedir(), 
"target/local-repo").getAbsolutePath());
+
+        MavenExecutionRequest request = new DefaultMavenExecutionRequest();
+        request.setLocalRepository(localRepo);
+
+        RemoteRepository centralRepo =
+                new RemoteRepository.Builder("central", "default", 
"https://repo.maven.apache.org/maven2";).build();
+
+        DefaultRepositorySystemSession systemSession = 
repoSessionFactory.newRepositorySession(request);
+        
Mockito.when(mavenSession.getRepositorySession()).thenReturn(systemSession);
+        Mockito.when(mavenSession.getRequest()).thenReturn(request);
+        Mockito.when(testMavenProject.getRemoteProjectRepositories())
+                .thenReturn(Collections.singletonList(centralRepo));
+
+        Plugin plugin = new Plugin();
+        plugin.setGroupId("org.apache.maven.plugins");
+        plugin.setArtifactId("maven-pmd-plugin");
+        Mockito.when(mojoExecution.getPlugin()).thenReturn(plugin);
     }
 
-    public void testDefaultConfiguration() throws Exception {
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testDefaultConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
 
-        File generatedReport = generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -99,13 +177,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(output.contains("PMD version: " + 
AbstractPmdReport.getPmdVersion()));
     }
 
-    public void testDefaultConfigurationNotRenderRuleViolationPriority() 
throws Exception {
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-report-not-render-rule-priority-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void 
testDefaultConfigurationNotRenderRuleViolationPriority(PmdReport mojo) throws 
Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
 
-        File generatedReport = generateReport(
-                getGoal(), 
"default-configuration/pmd-report-not-render-rule-priority-plugin-config.xml");
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         String str = readFile(generatedReport);
@@ -114,13 +196,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(str.contains("<th>Priority</th>"));
     }
 
-    public void testDefaultConfigurationNoRenderViolationsByPriority() throws 
Exception {
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-report-no-render-violations-by-priority.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testDefaultConfigurationNoRenderViolationsByPriority(PmdReport 
mojo) throws Exception {
+        mojo.execute();
 
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/pmd-report-no-render-violations-by-priority.xml");
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         String str = readFile(generatedReport);
@@ -133,12 +219,12 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertEquals(1, StringUtils.countMatches(str, 
"def/configuration/App.java"));
     }
 
-    public void testDefaultConfigurationWithAnalysisCache() throws Exception {
-        FileUtils.copyDirectoryStructure(
-                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(getGoal(), 
"default-configuration/pmd-with-analysis-cache-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-with-analysis-cache-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testDefaultConfigurationWithAnalysisCache(PmdReport mojo) 
throws Exception {
+        mojo.execute();
 
         // check if the PMD analysis cache file has been generated
         File cacheFile =
@@ -146,9 +232,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(cacheFile.exists());
     }
 
-    public void testJavascriptConfiguration() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/javascript-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"javascript-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testJavascriptConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -172,14 +266,11 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(str.contains("Avoid using global variables"));
     }
 
-    public void testFileURL() throws Exception {
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
-
-        File testPom = new File(
-                getBasedir(), 
"src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml");
-        PmdReport mojo = (PmdReport) createReportMojo(getGoal(), testPom);
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testFileURL(PmdReport mojo) throws Exception {
 
         // Additional test case for MPMD-174 
(https://issues.apache.org/jira/browse/MPMD-174).
         int port = determineFreePort();
@@ -220,7 +311,12 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         URL url3 = 
getClass().getClassLoader().getResource("category/java/errorprone.xml");
         mojo.setRulesets(new String[] {url.toString(), url2.toString(), 
url3.toString(), sonarExportRulesetUrl});
 
-        File generatedReport = generateReport(mojo, testPom);
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -266,8 +362,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
      *
      * @throws Exception
      */
-    public void testCustomConfiguration() throws Exception {
-        File generatedReport = generateReport(getGoal(), 
"custom-configuration/custom-configuration-plugin-config.xml");
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "pmd", pom = "custom-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testCustomConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check the generated files
@@ -289,8 +394,8 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(lowerCaseContains(str, "Avoid using if...else statements 
without curly braces"));
 
         assertFalse(
-                "unnecessary constructor should not be triggered because of 
low priority",
-                lowerCaseContains(str, "Avoid unnecessary constructors - the 
compiler will generate these for you"));
+                lowerCaseContains(str, "Avoid unnecessary constructors - the 
compiler will generate these for you"),
+                "unnecessary constructor should not be triggered because of 
low priority");
 
         // veryLongVariableNameWithViolation is really too long
         assertTrue(lowerCaseContains(str, 
"veryLongVariableNameWithViolation"));
@@ -303,8 +408,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
      *
      * @throws Exception
      */
-    public void testSkipConfiguration() throws Exception {
-        File generatedReport = generateReport(getGoal(), 
"custom-configuration/skip-plugin-config.xml");
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "pmd", pom = "skip-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testSkipConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertFalse(generatedReport.exists());
 
         // verify the generated files do not exist because PMD was skipped
@@ -319,14 +433,31 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         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(getGoal(), 
"empty-report/skip-empty-report-plugin-config.xml");
+    @Basedir("/unit/empty-report")
+    @InjectMojo(goal = "pmd", pom = "skip-empty-report-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testSkipEmptyReportConfiguration(PmdReport mojo) throws 
Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertFalse(generatedReport.exists());
     }
 
-    public void testEmptyReportConfiguration() throws Exception {
-        File generatedReport = generateReport(getGoal(), 
"empty-report/empty-report-plugin-config.xml");
+    @Basedir("/unit/empty-report")
+    @InjectMojo(goal = "pmd", pom = "empty-report-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testEmptyReportConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // verify the generated files do exist, even if there are no violations
@@ -338,26 +469,30 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(str.contains("Violations By Priority</h2>"));
     }
 
-    public void testInvalidFormat() throws Exception {
+    @Basedir("/unit/invalid-format")
+    @InjectMojo(goal = "pmd", pom = "invalid-format-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testInvalidFormat(PmdReport mojo) {
         try {
-            File testPom =
-                    new File(getBasedir(), 
"src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml");
-            AbstractPmdReport mojo = createReportMojo(getGoal(), testPom);
-            setVariableValueToObject(
-                    mojo, "compileSourceRoots", 
mojo.getProject().getCompileSourceRoots());
-            generateReport(mojo, testPom);
-
-            fail("Must nest MavenReportException.");
+
+            mojo.execute();
+
+            fail("Must nested MavenReportException.");
         } catch (MojoExecutionException e) {
             assertTrue(e.getCause() instanceof MavenReportException);
         }
     }
 
-    public void testInvalidTargetJdk() throws Exception {
+    @Basedir("/unit/invalid-format")
+    @InjectMojo(goal = "pmd", pom = "invalid-target-jdk-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testInvalidTargetJdk(PmdReport mojo) throws Exception {
         try {
-            generateReport(getGoal(), 
"invalid-format/invalid-target-jdk-plugin-config.xml");
+            mojo.execute();
 
-            fail("Must nest MavenReportException.");
+            fail("Must nested MavenReportException.");
         } catch (MojoExecutionException e) {
             assertTrue(e.getCause() instanceof MavenReportException);
         }
@@ -366,9 +501,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
     /**
      * Verify the pmd.xml file is included in the reports when requested.
      */
-    public void testIncludeXmlInReports() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/pmd-report-include-xml-in-reports-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-report-include-xml-in-reports-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testIncludeXmlInReports(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // verify the pmd file is included in site
@@ -386,26 +529,34 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
     /**
      * Verify the correct working of the locationTemp method.
      */
-    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(getGoal(), testPom);
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testLocationTemp(PmdReport mojo) {
 
         assertEquals(
-                "locationTemp is not correctly encoding filename",
                 "001-export_format_pmd_language_java_name_some_2520name.xml",
                 mojo.getLocationTemp(
                         
"http://nemo.sonarsource.org/sonar/profiles/export?format=pmd&language=java&name=some%2520name";,
-                        1));
+                        1),
+                "locationTemp is not correctly encoding filename");
     }
 
     /**
      * Verify that suppressMarker works.
      */
-    public void testSuppressMarkerConfiguration() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/pmd-with-suppressMarker-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-with-suppressMarker-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testSuppressMarkerConfiguration(PmdReport mojo) throws 
Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -427,9 +578,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(report.contains("Avoid unused private fields such as 
'unusedVar2'."));
     }
 
-    public void testSuppressMarkerConfigurationWithoutRendering() throws 
Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"default-configuration/pmd-with-suppressMarker-no-render-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-with-suppressMarker-no-render-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testSuppressMarkerConfigurationWithoutRendering(PmdReport 
mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -451,8 +610,17 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(report.contains("Avoid unused private fields such as 
'unusedVar2'."));
     }
 
-    public void testJspConfiguration() throws Exception {
-        File generatedReport = generateReport(getGoal(), 
"default-configuration/jsp-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "jsp-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testJspConfiguration(PmdReport mojo) throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         // check if the PMD files were generated
@@ -486,22 +654,35 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(str.contains("Avoid having style information in JSP 
files."));
     }
 
-    public void testPMDProcessingError() throws Exception {
+    @Basedir("/unit/processing-error")
+    @InjectMojo(goal = "pmd", pom = "pmd-processing-error-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPMDProcessingError(PmdReport mojo) {
         try {
-            generateReport(getGoal(), 
"processing-error/pmd-processing-error-plugin-config.xml");
+            mojo.execute();
+
             fail("Expected exception");
         } catch (MojoExecutionException e) {
             assertTrue(e.getCause().getMessage().endsWith("Found 1 PMD 
processing error"));
         }
     }
 
-    public void testPMDProcessingErrorWithDetailsSkipped() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"processing-error/pmd-processing-error-skip-plugin-config.xml");
+    @Basedir("/unit/processing-error")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-processing-error-skip-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPMDProcessingErrorWithDetailsSkipped(PmdReport mojo) 
throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         String output = CapturingPrintStream.getOutput();
-        assertTrue(output, output.contains("There is 1 PMD processing 
error:"));
+        assertTrue(output.contains("There is 1 PMD processing error:"), 
output);
 
         File generatedFile = new File(getBasedir(), 
"target/test/unit/parse-error/target/pmd.xml");
         assertTrue(generatedFile.exists());
@@ -517,13 +698,21 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertTrue(html.contains("at line 23, column 5: Encountered"));
     }
 
-    public void testPMDProcessingErrorWithDetailsNoReport() throws Exception {
-        File generatedReport =
-                generateReport(getGoal(), 
"processing-error/pmd-processing-error-no-report-plugin-config.xml");
+    @Basedir("/unit/processing-error")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-processing-error-no-report-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPMDProcessingErrorWithDetailsNoReport(PmdReport mojo) 
throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
+
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         String output = CapturingPrintStream.getOutput();
-        assertTrue(output, output.contains("There is 1 PMD processing 
error:"));
+        assertTrue(output.contains("There is 1 PMD processing error:"), 
output);
 
         File generatedFile = new File(getBasedir(), 
"target/test/unit/parse-error/target/pmd.xml");
         assertTrue(generatedFile.exists());
@@ -539,23 +728,31 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(html.contains("at line 23, column 5: Encountered"));
     }
 
-    public void testPMDExcludeRootsShouldExcludeSubdirectories() throws 
Exception {
-        generateReport(getGoal(), 
"exclude-roots/pmd-exclude-roots-plugin-config.xml");
+    @Basedir("/unit/exclude-roots")
+    @InjectMojo(goal = "pmd", pom = "pmd-exclude-roots-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPMDExcludeRootsShouldExcludeSubdirectories(PmdReport mojo) 
throws Exception {
+        mojo.execute();
 
         File generatedFile = new File(getBasedir(), 
"target/test/unit/exclude-roots/target/pmd.xml");
         assertTrue(generatedFile.exists());
         String str = readFile(generatedFile);
 
-        assertTrue("Seems like all directories are excluded now", 
str.contains("ForLoopShouldBeWhileLoop"));
+        assertTrue(str.contains("ForLoopShouldBeWhileLoop"), "Seems like all 
directories are excluded now");
         assertFalse(
-                "Exclusion of an exact source directory not working", 
str.contains("OverrideBothEqualsAndHashcode"));
+                str.contains("OverrideBothEqualsAndHashcode"), "Exclusion of 
an exact source directory not working");
         assertFalse(
-                "Exclusion of base directory with subdirectories not working 
(MPMD-178)",
-                str.contains("JumbledIncrementer"));
+                str.contains("JumbledIncrementer"),
+                "Exclusion of base directory with subdirectories not working 
(MPMD-178)");
     }
 
-    public void testViolationExclusion() throws Exception {
-        generateReport(getGoal(), 
"default-configuration/pmd-report-pmd-exclusions-configuration-plugin-config.xml");
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = 
"pmd-report-pmd-exclusions-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testViolationExclusion(PmdReport mojo) throws Exception {
+        mojo.execute();
 
         File generatedFile = new File(getBasedir(), 
"target/test/unit/default-configuration/target/pmd.xml");
         assertTrue(generatedFile.exists());
@@ -564,23 +761,30 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertFalse(str.contains("<violation"));
     }
 
+    @Test
     public void testCustomRenderer() throws MavenReportException {
         final Renderer renderer = 
PmdExecutor.createRenderer("net.sourceforge.pmd.renderers.TextRenderer", 
"UTF-8");
         assertNotNull(renderer);
     }
 
+    @Test
     public void testCodeClimateRenderer() throws MavenReportException {
         final Renderer renderer =
                 
PmdExecutor.createRenderer("net.sourceforge.pmd.renderers.CodeClimateRenderer", 
"UTF-8");
         assertNotNull(renderer);
     }
 
-    public void testPmdReportCustomRulesNoExternalInfoUrl() throws Exception {
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "pmd-report-custom-rules.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPmdReportCustomRulesNoExternalInfoUrl(PmdReport mojo) 
throws Exception {
+        mojo.execute();
+
+        File outputDir = mojo.getReportOutputDirectory();
+        String filename = mojo.getOutputPath() + ".html";
 
-        File generatedReport = generateReport(getGoal(), 
"default-configuration/pmd-report-custom-rules.xml");
+        File generatedReport = new File(outputDir, filename);
         assertTrue(generatedReport.exists());
 
         String str = readFile(generatedReport);
@@ -591,7 +795,11 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         assertEquals(4, StringUtils.countMatches(str, 
"\">UnusedPrivateField</a></td>"));
     }
 
-    public void testPmdReportResolveRulesets() throws Exception {
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "pmd", pom = "pmd-report-resolve-rulesets.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @Test
+    public void testPmdReportResolveRulesets(PmdReport mojo) throws Exception {
         int port = determineFreePort();
         WireMockServer mockServer = new WireMockServer(port);
         mockServer.start();
@@ -627,17 +835,10 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
                         .withHeader("Content-Type", "text/xml")
                         .withBody(sonarRuleset)));
 
-        FileUtils.copyDirectoryStructure(
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/jxr-files"),
-                new File(getBasedir(), 
"target/test/unit/default-configuration/target/site"));
-
-        File testPom =
-                new File(getBasedir(), 
"src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml");
-        PmdReport mojo = (PmdReport) createReportMojo(getGoal(), testPom);
         mojo.rulesets[3] = sonarExportRulesetUrl;
         mojo.rulesets[4] = myRulesetUrl;
         mojo.rulesets[5] = notAInternalRulesetUrl;
-        generateReport(mojo, testPom);
+        mojo.execute();
 
         // these are the rulesets, that have been copied to target/pmd/rulesets
         File generatedFile = new File(
@@ -669,8 +870,10 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         mockServer.stop();
     }
 
-    @Override
-    protected String getGoal() {
-        return "pmd";
+    /**
+     * Read the contents of the specified file into a string.
+     */
+    protected String readFile(File file) throws IOException {
+        return new String(Files.readAllBytes(file.toPath()));
     }
 }
diff --git 
a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnLinuxTest.java
 
b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnLinuxTest.java
new file mode 100644
index 0000000..ca10b86
--- /dev/null
+++ 
b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnLinuxTest.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.pmd;
+
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.condition.OS.LINUX;
+import static org.junit.jupiter.api.condition.OS.MAC;
+
+/**
+ * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
+ * @version $Id$
+ */
+@MojoTest
+@EnabledOnOs({LINUX, MAC})
+public class PmdViolationCheckMojoOnLinuxTest {
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testDefaultConfiguration(PmdViolationCheckMojo mojo) throws 
Exception {
+        try {
+            mojo.execute();
+
+            fail("MojoFailureException should be thrown.");
+        } catch (final MojoFailureException e) {
+            assertTrue(
+                    e.getMessage().startsWith("PMD " + 
AbstractPmdReport.getPmdVersion() + " has found 8 violations."));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-notfailonviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testNotFailOnViolation(PmdViolationCheckMojo mojo) throws 
Exception {
+
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-notfailmaxviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testNotFailMaxAllowedViolations(PmdViolationCheckMojo mojo) 
throws Exception {
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failmaxviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testFailMaxAllowedViolations(PmdViolationCheckMojo mojo) 
throws Exception {
+        try {
+            mojo.execute();
+            fail("Exception Expected");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage()
+                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
+                            + " has found 5 violations and issued 3 
warnings."));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failonpriority-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testFailurePriority(PmdViolationCheckMojo mojo) throws 
Exception {
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failandwarnonpriority-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testFailureAndWarningPriority(PmdViolationCheckMojo mojo) 
throws Exception {
+        try {
+            mojo.execute();
+            fail("MojoFailureException expected");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage()
+                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
+                            + " has found 5 violations and issued 3 
warnings."));
+        }
+    }
+
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-exception-test-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testException(PmdViolationCheckMojo mojo) throws Exception {
+        try {
+            mojo.project = new MavenProject();
+            mojo.execute();
+
+            fail("MojoFailureException should be thrown.");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage().contains("Unable to perform check"));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-pmd-exclusions-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report")
+    @Test
+    public void testViolationExclusion(PmdViolationCheckMojo mojo) throws 
Exception {
+        // this call shouldn't throw an exception, as the classes with 
violations have been excluded
+        mojo.execute();
+    }
+}
diff --git 
a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnWindowsTest.java
 
b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnWindowsTest.java
new file mode 100644
index 0000000..2373d7c
--- /dev/null
+++ 
b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoOnWindowsTest.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.pmd;
+
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoParameter;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.condition.OS.WINDOWS;
+
+/**
+ * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
+ * @version $Id$
+ */
+@MojoTest
+@EnabledOnOs(WINDOWS)
+public class PmdViolationCheckMojoOnWindowsTest {
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-default-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testDefaultConfiguration(PmdViolationCheckMojo mojo) throws 
Exception {
+        try {
+            mojo.execute();
+
+            fail("MojoFailureException should be thrown.");
+        } catch (final MojoFailureException e) {
+            assertTrue(
+                    e.getMessage().startsWith("PMD " + 
AbstractPmdReport.getPmdVersion() + " has found 8 violations."));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-notfailonviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testNotFailOnViolation(PmdViolationCheckMojo mojo) throws 
Exception {
+
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-notfailmaxviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testNotFailMaxAllowedViolations(PmdViolationCheckMojo mojo) 
throws Exception {
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failmaxviolation-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testFailMaxAllowedViolations(PmdViolationCheckMojo mojo) 
throws Exception {
+        try {
+            mojo.execute();
+            fail("Exception Expected");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage()
+                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
+                            + " has found 5 violations and issued 3 
warnings."));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failonpriority-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testFailurePriority(PmdViolationCheckMojo mojo) throws 
Exception {
+        mojo.execute();
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-failandwarnonpriority-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testFailureAndWarningPriority(PmdViolationCheckMojo mojo) 
throws Exception {
+        try {
+            mojo.execute();
+            fail("MojoFailureException expected");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage()
+                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
+                            + " has found 5 violations and issued 3 
warnings."));
+        }
+    }
+
+    @Basedir("/unit/custom-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-exception-test-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testException(PmdViolationCheckMojo mojo) throws Exception {
+        try {
+            mojo.project = new MavenProject();
+            mojo.execute();
+
+            fail("MojoFailureException should be thrown.");
+        } catch (final MojoFailureException e) {
+            assertTrue(e.getMessage().contains("Unable to perform check"));
+        }
+    }
+
+    @Basedir("/unit/default-configuration")
+    @InjectMojo(goal = "check", pom = 
"pmd-check-pmd-exclusions-configuration-plugin-config.xml")
+    @MojoParameter(name = "siteDirectory", value = "src/site")
+    @MojoParameter(name = "targetDirectory", value = "pmd-report-windows")
+    @Test
+    public void testViolationExclusion(PmdViolationCheckMojo mojo) throws 
Exception {
+        // this call shouldn't throw an exception, as the classes with 
violations have been excluded
+        mojo.execute();
+    }
+}
diff --git 
a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java 
b/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java
deleted file mode 100644
index 160d11b..0000000
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojoTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.maven.plugins.pmd;
-
-import java.io.File;
-
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-
-/**
- * @author <a href="mailto:[email protected]";>Maria Odea Ching</a>
- * @version $Id$
- */
-public class PmdViolationCheckMojoTest extends AbstractPmdReportTestCase {
-
-    public void testDefaultConfiguration() throws Exception {
-        generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
-
-        try {
-            final File testPom = new File(
-                    getBasedir(),
-                    
"src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml");
-            final PmdViolationCheckMojo mojo = lookupMojo(getGoal(), testPom);
-            mojo.execute();
-
-            fail("MojoFailureException should be thrown.");
-        } catch (final MojoFailureException e) {
-            assertTrue(
-                    e.getMessage().startsWith("PMD " + 
AbstractPmdReport.getPmdVersion() + " has found 8 violations."));
-        }
-    }
-
-    public void testNotFailOnViolation() throws Exception {
-        generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml");
-        final PmdViolationCheckMojo pmdViolationMojo = lookupMojo(getGoal(), 
testPom);
-        pmdViolationMojo.execute();
-    }
-
-    public void testMaxAllowedViolations() throws Exception {
-        generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml");
-        final PmdViolationCheckMojo pmdViolationMojo = lookupMojo(getGoal(), 
testPom);
-        pmdViolationMojo.execute();
-
-        testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml");
-        final PmdViolationCheckMojo pmdViolationMojoFail = 
lookupMojo(getGoal(), testPom);
-
-        try {
-            pmdViolationMojoFail.execute();
-            fail("Exception Expected");
-        } catch (final MojoFailureException e) {
-            assertTrue(e.getMessage()
-                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
-                            + " has found 5 violations and issued 3 
warnings."));
-        }
-    }
-
-    public void testFailurePriority() throws Exception {
-        generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml");
-        PmdViolationCheckMojo pmdViolationCheckMojo = lookupMojo(getGoal(), 
testPom);
-        pmdViolationCheckMojo.execute();
-
-        testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml");
-        pmdViolationCheckMojo = lookupMojo(getGoal(), testPom);
-
-        try {
-            pmdViolationCheckMojo.execute();
-            fail("MojoFailureException expected");
-        } catch (final MojoFailureException e) {
-            assertTrue(e.getMessage()
-                    .startsWith("PMD " + AbstractPmdReport.getPmdVersion()
-                            + " has found 5 violations and issued 3 
warnings."));
-        }
-    }
-
-    public void testException() throws Exception {
-        try {
-            final File testPom = new File(
-                    getBasedir(),
-                    
"src/test/resources/unit/custom-configuration/pmd-check-exception-test-plugin-config.xml");
-            final PmdViolationCheckMojo mojo = lookupMojo(getGoal(), testPom);
-            mojo.project = new MavenProject();
-            mojo.execute();
-
-            fail("MojoFailureException should be thrown.");
-        } catch (final MojoFailureException e) {
-            assertNotNull(e.getMessage());
-        }
-    }
-
-    public void testViolationExclusion() throws Exception {
-        generateReport("pmd", 
"default-configuration/default-configuration-plugin-config.xml");
-
-        File testPom = new File(
-                getBasedir(),
-                
"src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml");
-        final PmdViolationCheckMojo pmdViolationMojo = 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/exec/ExecutorTest.java 
b/src/test/java/org/apache/maven/plugins/pmd/exec/ExecutorTest.java
index 3aaaf4a..9039789 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/exec/ExecutorTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/exec/ExecutorTest.java
@@ -23,11 +23,13 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 
-import junit.framework.TestCase;
 import org.apache.commons.lang3.SystemUtils;
-import org.junit.Assert;
+import org.junit.jupiter.api.Test;
 
-public class ExecutorTest extends TestCase {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ExecutorTest {
+    @Test
     public void testBuildClasspath() throws MalformedURLException {
         String basename = "home/test/dir with space/mylib.jar";
         String pathname = new File("/", basename).getPath();
@@ -39,6 +41,6 @@ public class ExecutorTest extends TestCase {
 
         StringBuilder classpath = new StringBuilder();
         Executor.buildClasspath(classpath, mockedClassLoader);
-        Assert.assertEquals(pathname + File.pathSeparator, 
classpath.toString());
+        assertEquals(pathname + File.pathSeparator, classpath.toString());
     }
 }
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 0f9a70e..b1e5002 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
@@ -81,7 +81,9 @@ public abstract class PmdProjectStub extends MavenProjectStub 
{
 
     @Override
     public File getBasedir() {
-        return new File(super.getBasedir() + "/src/test/resources/unit/");
+        // Workaround to get basedir, MavenProjectStub use 
PlexusTestCase/TestCase which is not available in Junit 5
+        String basedir = System.getProperty("basedir", new 
File("").getAbsolutePath());
+        return new File(basedir + "/src/test/resources/unit/");
     }
 
     @Override
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 8ace070..041e674 100644
--- a/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml
+++ b/src/test/resources/unit/CpdReportTest/with-cpd-errors/pom.xml
@@ -41,7 +41,7 @@ under the License.
                     
<xrefLocation>${basedir}/target/test/unit/CpdReportTest/with-cpd-errors/target/site/xref</xrefLocation>
                     <minimumTokens>100</minimumTokens>
                     <compileSourceRoots>
-                        
<compileSourceRoot>${basedir}/src/test/resources/unit/CpdReportTest/with-cpd-errors/src/main/java</compileSourceRoot>
+                        <compileSourceRoot>${basedir}</compileSourceRoot>
                     </compileSourceRoots>
                     <inputEncoding>UTF-8</inputEncoding>
                 </configuration>
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 6fd8a79..cc96f99 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
@@ -44,7 +44,7 @@ under the License.
             <exclude>**/Sample.java</exclude>
           </excludes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/custom-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
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 ffc2903..9135b2a 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
@@ -40,7 +40,7 @@ under the License.
           <linkXRef>false</linkXRef>
           <minimumTokens>30</minimumTokens>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/custom-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
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 d1ff3f4..86fb5e9 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
@@ -43,7 +43,7 @@ under the License.
           <inputEncoding>ISO-8859-1</inputEncoding>
           <rulesets>
             <ruleset>rulesets/java/maven-pmd-plugin-default.xml</ruleset>
-            
<ruleset>${basedir}/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml</ruleset>
+            <ruleset>${basedir}/resources/rulesets/custom.xml</ruleset>
           </rulesets>
           <targetJdk>1.4</targetJdk>
           <minimumPriority>4</minimumPriority>
@@ -52,7 +52,7 @@ under the License.
             <exclude>**/AnotherSample.java</exclude>
           </excludes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/custom-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
         <dependencies>
diff --git 
a/src/test/resources/unit/custom-configuration/skip-plugin-config.xml 
b/src/test/resources/unit/custom-configuration/skip-plugin-config.xml
index 6f6f159..db66141 100644
--- a/src/test/resources/unit/custom-configuration/skip-plugin-config.xml
+++ b/src/test/resources/unit/custom-configuration/skip-plugin-config.xml
@@ -44,6 +44,9 @@ under the License.
           <targetJdk>1.4</targetJdk>
           <minimumPriority>4</minimumPriority>
           <skip>true</skip>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
         <dependencies>
           <dependency>
diff --git 
a/src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml
index ccaf925..f27d020 100644
--- 
a/src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/cpd-check-cpd-exclusions-configuration-plugin-config.xml
@@ -38,7 +38,7 @@ under the License.
           <failOnViolation>true</failOnViolation>
           <verbose>false</verbose>
           <printFailingErrors>true</printFailingErrors>
-          
<excludeFromFailureFile>${basedir}/src/test/resources/unit/excludes/my-exclude-cpd.properties</excludeFromFailureFile>
+          
<excludeFromFailureFile>${basedir}/excludes/my-exclude-cpd.properties</excludeFromFailureFile>
         </configuration>
       </plugin>
     </plugins>
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 a201c3e..2d53555 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
@@ -41,7 +41,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <minimumTokens>100</minimumTokens>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
diff --git 
a/src/test/resources/unit/default-configuration/cpd-encoding-configuration-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/cpd-encoding-configuration-plugin-config.xml
index 66b4532..c3b5bba 100644
--- 
a/src/test/resources/unit/default-configuration/cpd-encoding-configuration-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/cpd-encoding-configuration-plugin-config.xml
@@ -41,7 +41,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <minimumTokens>100</minimumTokens>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
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 089fb48..92cfee2 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
@@ -44,7 +44,7 @@ under the License.
             <include>**/*.js</include>
           </includes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
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 3cb44b3..0e0442c 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
@@ -44,7 +44,7 @@ under the License.
             <include>**/*.jsp</include>
           </includes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
         </configuration>
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 76efc02..9e1a686 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
@@ -41,10 +41,10 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <minimumTokens>100</minimumTokens>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
-          
<excludeFromFailureFile>${basedir}/src/test/resources/unit/excludes/my-exclude-cpd.properties</excludeFromFailureFile>
+          
<excludeFromFailureFile>${basedir}/excludes/my-exclude-cpd.properties</excludeFromFailureFile>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
 
b/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
index afe562b..c80008e 100644
--- 
a/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
+++ 
b/src/test/resources/unit/default-configuration/cpd-report-include-xml-in-reports-config.xml
@@ -41,7 +41,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <minimumTokens>100</minimumTokens>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
           <includeXmlInReports>true</includeXmlInReports>
diff --git 
a/src/test/resources/unit/default-configuration/cpd-report-windows/cpd.xml 
b/src/test/resources/unit/default-configuration/cpd-report-windows/cpd.xml
new file mode 100644
index 0000000..044be1b
--- /dev/null
+++ b/src/test/resources/unit/default-configuration/cpd-report-windows/cpd.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<pmd-cpd xmlns="https://pmd-code.org/schema/cpd-report";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         pmdVersion="7.18.0"
+         timestamp="2025-12-15T18:37:21.398597428+01:00"
+         version="1.0.0"
+         xsi:schemaLocation="https://pmd-code.org/schema/cpd-report 
https://pmd.github.io/schema/cpd-report_1_0_0.xsd";>
+   <file 
path="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\App.java"
+         totalNumberOfTokens="182"/>
+   <file 
path="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\App2.java"
+         totalNumberOfTokens="5"/>
+   <file 
path="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\AppSample.java"
+         totalNumberOfTokens="151"/>
+   <duplication lines="29" tokens="104">
+      <file begintoken="78"
+            column="5"
+            endcolumn="2"
+            endline="99"
+            endtoken="181"
+            line="71"
+            
path="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\App.java"/>
+      <file begintoken="236"
+            column="5"
+            endcolumn="2"
+            endline="77"
+            endtoken="339"
+            line="50"
+            
path="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\AppSample.java"/>
+      <codefragment><![CDATA[    }
+
+
+    public String dup( String str )
+    {
+        String tmp = "";
+
+        for( int i = 0; i < str.length(); i++ )
+        {
+            if ( i != ( ( str.length() -1 ) ) )
+            {
+                tmp = tmp + str.substring( i, i + 1);
+            }
+            else
+            {
+                tmp = tmp + str.substring( i );
+            }
+        }
+
+        if ("".equals( tmp ))
+        {
+                tmp = "EMPTY";
+        }
+
+        System.out.println( "The value of tmp is " + tmp );
+        return tmp;
+    }
+
+}
+]]></codefragment>
+   </duplication>
+</pmd-cpd>
diff --git a/src/test/resources/unit/default-configuration/cpd-report/cpd.xml 
b/src/test/resources/unit/default-configuration/cpd-report/cpd.xml
new file mode 100644
index 0000000..bff8d07
--- /dev/null
+++ b/src/test/resources/unit/default-configuration/cpd-report/cpd.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<pmd-cpd xmlns="https://pmd-code.org/schema/cpd-report";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         pmdVersion="7.18.0"
+         timestamp="2025-12-15T18:37:21.398597428+01:00"
+         version="1.0.0"
+         xsi:schemaLocation="https://pmd-code.org/schema/cpd-report 
https://pmd.github.io/schema/cpd-report_1_0_0.xsd";>
+   <file 
path="/home/user/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/App.java"
+         totalNumberOfTokens="182"/>
+   <file 
path="/home/user/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/App2.java"
+         totalNumberOfTokens="5"/>
+   <file 
path="/home/user/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/AppSample.java"
+         totalNumberOfTokens="151"/>
+   <duplication lines="29" tokens="104">
+      <file begintoken="78"
+            column="5"
+            endcolumn="2"
+            endline="99"
+            endtoken="181"
+            line="71"
+            
path="/home/user/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/App.java"/>
+      <file begintoken="236"
+            column="5"
+            endcolumn="2"
+            endline="77"
+            endtoken="339"
+            line="50"
+            
path="/home/user/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/AppSample.java"/>
+      <codefragment><![CDATA[    }
+
+
+    public String dup( String str )
+    {
+        String tmp = "";
+
+        for( int i = 0; i < str.length(); i++ )
+        {
+            if ( i != ( ( str.length() -1 ) ) )
+            {
+                tmp = tmp + str.substring( i, i + 1);
+            }
+            else
+            {
+                tmp = tmp + str.substring( i );
+            }
+        }
+
+        if ("".equals( tmp ))
+        {
+                tmp = "EMPTY";
+        }
+
+        System.out.println( "The value of tmp is " + tmp );
+        return tmp;
+    }
+
+}
+]]></codefragment>
+   </duplication>
+</pmd-cpd>
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 fb99dbf..16bc1d3 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
@@ -42,7 +42,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
         <dependencies>
diff --git 
a/src/test/resources/unit/default-configuration/excludes/my-exclude-cpd.properties
 
b/src/test/resources/unit/default-configuration/excludes/my-exclude-cpd.properties
new file mode 100644
index 0000000..c58713b
--- /dev/null
+++ 
b/src/test/resources/unit/default-configuration/excludes/my-exclude-cpd.properties
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+def.configuration.App,def.configuration.AppSample
diff --git 
a/src/test/resources/unit/default-configuration/excludes/pmd_exclude.properties 
b/src/test/resources/unit/default-configuration/excludes/pmd_exclude.properties
new file mode 100644
index 0000000..07b5d52
--- /dev/null
+++ 
b/src/test/resources/unit/default-configuration/excludes/pmd_exclude.properties
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+def.configuration.App=UnusedPrivateField,EmptyCatchBlock,UselessParentheses
+def.configuration.App2=UnnecessaryImport
+def.configuration.AppSample=UnusedPrivateField,UnusedFormalParameter,UnusedPrivateMethod,UselessParentheses
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 791540f..99dd156 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
@@ -49,7 +49,7 @@ under the License.
             <include>**/*.js</include>
           </includes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/js</compileSourceRoot>
+            <compileSourceRoot>${basedir}/js</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
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 a0fa7f4..9884962 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
@@ -51,7 +51,7 @@ under the License.
             <include>**/*.jsp</include>
           </includes>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/jsp</compileSourceRoot>
+            <compileSourceRoot>${basedir}/jsp</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml
index d715f86..2c77708 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml
@@ -37,6 +37,9 @@ under the License.
           
<targetDirectory>${basedir}/target/test/unit/default-configuration/target</targetDirectory>
           <failOnViolation>true</failOnViolation>
           <printFailingErrors>true</printFailingErrors>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml
index 65ab436..9ee1351 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-failandwarnonpriority-plugin-config.xml
@@ -38,6 +38,9 @@ under the License.
            <failOnViolation>true</failOnViolation>
            <failurePriority>3</failurePriority>
            <verbose>true</verbose>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml
index e7a1ddc..03c510e 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-failmaxviolation-plugin-config.xml
@@ -39,6 +39,9 @@ under the License.
                     <failurePriority>3</failurePriority>
                     <verbose>true</verbose>
                     <maxAllowedViolations>3</maxAllowedViolations>
+                    <compileSourceRoots>
+                        <compileSourceRoot>${basedir}</compileSourceRoot>
+                    </compileSourceRoots>
                 </configuration>
             </plugin>
         </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml
index debd26c..a696288 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-failonpriority-plugin-config.xml
@@ -38,6 +38,9 @@ under the License.
           <failOnViolation>true</failOnViolation>
           <failurePriority>1</failurePriority>
           <verbose>false</verbose>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml
index 118fb50..3918e90 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-notfailmaxviolation-plugin-config.xml
@@ -39,6 +39,9 @@ under the License.
                     <failurePriority>3</failurePriority>
                     <verbose>true</verbose>
                     <maxAllowedViolations>5</maxAllowedViolations>
+                    <compileSourceRoots>
+                        <compileSourceRoot>${basedir}</compileSourceRoot>
+                    </compileSourceRoots>
                 </configuration>
             </plugin>
         </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml
index 4873337..b3df097 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-notfailonviolation-plugin-config.xml
@@ -37,6 +37,9 @@ under the License.
           
<targetDirectory>${basedir}/target/test/unit/default-configuration/target</targetDirectory>
           <failOnViolation>false</failOnViolation>
           <verbose>false</verbose>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml
index 6c2e6b5..79a00a1 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-check-pmd-exclusions-configuration-plugin-config.xml
@@ -39,7 +39,10 @@ under the License.
           <failurePriority>4</failurePriority>
           <verbose>false</verbose>
           <printFailingErrors>true</printFailingErrors>
-          
<excludeFromFailureFile>${basedir}/src/test/resources/unit/excludes/pmd_exclude.properties</excludeFromFailureFile>
+          
<excludeFromFailureFile>${basedir}/excludes/pmd_exclude.properties</excludeFromFailureFile>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
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 c737e21..0e20e42 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,16 +36,16 @@ under the License.
           <project 
implementation="org.apache.maven.plugins.pmd.stubs.DefaultConfigurationMavenProjectStub"/>
           
<outputDirectory>${basedir}/target/test/unit/default-configuration/target/site</outputDirectory>
           
<targetDirectory>${basedir}/target/test/unit/default-configuration/target</targetDirectory>
-          
<rulesetsTargetDirectory>${basedir}/target/test/unit/default-configuration/target/pmd/rulesets</rulesetsTargetDirectory>
+          
<rulesetsTargetDirectory>${basedir}/target/pmd/rulesets</rulesetsTargetDirectory>
           <rulesets>
-            
<ruleset>${basedir}/src/test/resources/unit/default-configuration/rulesets/custom-rules.xml</ruleset>
+            <ruleset>${basedir}/rulesets/custom-rules.xml</ruleset>
           </rulesets>
           <format>xml</format>
           <linkXRef>true</linkXRef>
-          
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
+          <xrefLocation>${basedir}/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
 
b/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
index 88e269b..f1cb23f 100644
--- 
a/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
+++ 
b/src/test/resources/unit/default-configuration/pmd-report-include-xml-in-reports-config.xml
@@ -40,6 +40,9 @@ under the License.
           <format>xml</format>
           <inputEncoding>UTF-8</inputEncoding>
           <includeXmlInReports>true</includeXmlInReports>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
         <dependencies>
           <dependency>
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 9194f6f..8342819 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
@@ -42,7 +42,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <renderViolationsByPriority>false</renderViolationsByPriority>
         </configuration>
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 572a5e1..8f0456f 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
@@ -42,7 +42,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <renderRuleViolationPriority>false</renderRuleViolationPriority>
         </configuration>
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 3387d3e..47710e6 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
@@ -42,9 +42,9 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
-          
<excludeFromFailureFile>${basedir}/src/test/resources/unit/excludes/pmd_exclude.properties</excludeFromFailureFile>
+          
<excludeFromFailureFile>${basedir}/excludes/pmd_exclude.properties</excludeFromFailureFile>
         </configuration>
         <dependencies>
           <dependency>
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 b03474b..dc53712 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
@@ -38,7 +38,7 @@ under the License.
           
<targetDirectory>${basedir}/target/test/unit/default-configuration/target</targetDirectory>
           
<rulesetsTargetDirectory>${basedir}/target/test/unit/default-configuration/target/pmd/rulesets</rulesetsTargetDirectory>
           <rulesets>
-            
<ruleset>${basedir}/src/test/resources/unit/default-configuration/rulesets/custom-rules.xml</ruleset>
+            <ruleset>${basedir}/rulesets/custom-rules.xml</ruleset>
             <ruleset>category/java/bestpractices.xml</ruleset>
             <ruleset>category/java/design.xml</ruleset>
             <!-- note, the port of the http urls will be replaced by the unit 
test -->
@@ -51,7 +51,7 @@ under the License.
           
<xrefLocation>${basedir}/target/test/unit/default-configuration/target/site/xref</xrefLocation>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
diff --git 
a/src/test/resources/unit/default-configuration/pmd-report-windows/pmd.xml 
b/src/test/resources/unit/default-configuration/pmd-report-windows/pmd.xml
new file mode 100644
index 0000000..27df390
--- /dev/null
+++ b/src/test/resources/unit/default-configuration/pmd-report-windows/pmd.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<pmd xmlns="http://pmd.sourceforge.net/report/2.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://pmd.sourceforge.net/report/2.0.0 
https://pmd.github.io/schema/report_2_0_0.xsd"; version="7.18.0" 
timestamp="2025-12-15T19:12:14.544">
+<file 
name="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\App.java">
+<violation beginline="31" endline="31" begincolumn="17" endcolumn="27" 
rule="UnusedPrivateField" ruleset="Best Practices" package="def.configuration" 
class="App" variable="unusedVar2" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatefield";
 priority="3">
+Avoid unused private fields such as 'unusedVar2'.
+</violation>
+<violation beginline="56" endline="59" begincolumn="9" endcolumn="10" 
rule="EmptyCatchBlock" ruleset="Error Prone" package="def.configuration" 
class="App" method="sampleMethod" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_errorprone.html#emptycatchblock";
 priority="3">
+Avoid empty catch blocks
+</violation>
+<violation beginline="80" endline="80" begincolumn="23" endcolumn="46" 
rule="UselessParentheses" ruleset="Code Style" package="def.configuration" 
class="App" method="dup" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#uselessparentheses";
 priority="4">
+Duplicate parentheses around `str.length() - 1`.
+</violation>
+</file>
+<file 
name="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\App2.java">
+<violation beginline="22" endline="22" begincolumn="1" endcolumn="21" 
rule="UnnecessaryImport" ruleset="Code Style" package="def.configuration" 
class="App2" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#unnecessaryimport";
 priority="4">
+Unused import 'java.io.File'
+</violation>
+</file>
+<file 
name="C:\Users\user\dev\workspace\maven-pmd-plugin\src\test\resources\unit\default-configuration\def\configuration\AppSample.java">
+<violation beginline="27" endline="27" begincolumn="20" endcolumn="29" 
rule="UnusedPrivateField" ruleset="Best Practices" package="def.configuration" 
class="AppSample" variable="unusedVar" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatefield";
 priority="3">
+Avoid unused private fields such as 'unusedVar'.
+</violation>
+<violation beginline="45" endline="45" begincolumn="20" endcolumn="32" 
rule="UnusedPrivateMethod" ruleset="Best Practices" package="def.configuration" 
class="AppSample" method="unusedMethod" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatemethod";
 priority="3">
+Avoid unused private methods such as 'unusedMethod(String)'.
+</violation>
+<violation beginline="45" endline="45" begincolumn="41" endcolumn="53" 
rule="UnusedFormalParameter" ruleset="Best Practices" 
package="def.configuration" class="AppSample" method="unusedMethod" 
variable="notUsedParam" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedformalparameter";
 priority="3">
+Avoid unused method parameters such as 'notUsedParam'.
+</violation>
+<violation beginline="58" endline="58" begincolumn="23" endcolumn="46" 
rule="UselessParentheses" ruleset="Code Style" package="def.configuration" 
class="AppSample" method="dup" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#uselessparentheses";
 priority="4">
+Duplicate parentheses around `str.length() - 1`.
+</violation>
+</file>
+</pmd>
diff --git a/src/test/resources/unit/default-configuration/pmd-report/pmd.xml 
b/src/test/resources/unit/default-configuration/pmd-report/pmd.xml
new file mode 100644
index 0000000..71efd15
--- /dev/null
+++ b/src/test/resources/unit/default-configuration/pmd-report/pmd.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<pmd xmlns="http://pmd.sourceforge.net/report/2.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://pmd.sourceforge.net/report/2.0.0 
https://pmd.github.io/schema/report_2_0_0.xsd"; version="7.18.0" 
timestamp="2025-12-15T19:12:14.544">
+<file 
name="/home/user/dev/workspace/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/App.java">
+<violation beginline="31" endline="31" begincolumn="17" endcolumn="27" 
rule="UnusedPrivateField" ruleset="Best Practices" package="def.configuration" 
class="App" variable="unusedVar2" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatefield";
 priority="3">
+Avoid unused private fields such as 'unusedVar2'.
+</violation>
+<violation beginline="56" endline="59" begincolumn="9" endcolumn="10" 
rule="EmptyCatchBlock" ruleset="Error Prone" package="def.configuration" 
class="App" method="sampleMethod" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_errorprone.html#emptycatchblock";
 priority="3">
+Avoid empty catch blocks
+</violation>
+<violation beginline="80" endline="80" begincolumn="23" endcolumn="46" 
rule="UselessParentheses" ruleset="Code Style" package="def.configuration" 
class="App" method="dup" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#uselessparentheses";
 priority="4">
+Duplicate parentheses around `str.length() - 1`.
+</violation>
+</file>
+<file 
name="/home/user/dev/workspace/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/App2.java">
+<violation beginline="22" endline="22" begincolumn="1" endcolumn="21" 
rule="UnnecessaryImport" ruleset="Code Style" package="def.configuration" 
class="App2" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#unnecessaryimport";
 priority="4">
+Unused import 'java.io.File'
+</violation>
+</file>
+<file 
name="/home/user/dev/workspace/maven-pmd-plugin/src/test/resources/unit/default-configuration/def/configuration/AppSample.java">
+<violation beginline="27" endline="27" begincolumn="20" endcolumn="29" 
rule="UnusedPrivateField" ruleset="Best Practices" package="def.configuration" 
class="AppSample" variable="unusedVar" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatefield";
 priority="3">
+Avoid unused private fields such as 'unusedVar'.
+</violation>
+<violation beginline="45" endline="45" begincolumn="20" endcolumn="32" 
rule="UnusedPrivateMethod" ruleset="Best Practices" package="def.configuration" 
class="AppSample" method="unusedMethod" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedprivatemethod";
 priority="3">
+Avoid unused private methods such as 'unusedMethod(String)'.
+</violation>
+<violation beginline="45" endline="45" begincolumn="41" endcolumn="53" 
rule="UnusedFormalParameter" ruleset="Best Practices" 
package="def.configuration" class="AppSample" method="unusedMethod" 
variable="notUsedParam" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_bestpractices.html#unusedformalparameter";
 priority="3">
+Avoid unused method parameters such as 'notUsedParam'.
+</violation>
+<violation beginline="58" endline="58" begincolumn="23" endcolumn="46" 
rule="UselessParentheses" ruleset="Code Style" package="def.configuration" 
class="AppSample" method="dup" 
externalInfoUrl="https://docs.pmd-code.org/pmd-doc-7.18.0/pmd_rules_java_codestyle.html#uselessparentheses";
 priority="4">
+Duplicate parentheses around `str.length() - 1`.
+</violation>
+</file>
+</pmd>
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 642f124..031f771 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
@@ -44,7 +44,7 @@ under the License.
           <analysisCache>true</analysisCache>
           
<analysisCacheLocation>${basedir}/target/test/unit/pmd-with-analysis-cache-plugin-config/target/pmd/pmd.cache</analysisCacheLocation>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
         <dependencies>
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 d388969..371ca5e 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
@@ -44,7 +44,7 @@ under the License.
           <suppressMarker>SUPPRESSME</suppressMarker>
           <renderSuppressedViolations>false</renderSuppressedViolations>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
         <dependencies>
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 efd8523..2e93506 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
@@ -43,7 +43,7 @@ under the License.
           <inputEncoding>UTF-8</inputEncoding>
           <suppressMarker>SUPPRESSME</suppressMarker>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/default-configuration/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
         <dependencies>
diff --git 
a/src/test/resources/unit/empty-report/cpd-skip-empty-report-plugin-config.xml 
b/src/test/resources/unit/empty-report/cpd-skip-empty-report-plugin-config.xml
index 9109cda..2a977e4 100644
--- 
a/src/test/resources/unit/empty-report/cpd-skip-empty-report-plugin-config.xml
+++ 
b/src/test/resources/unit/empty-report/cpd-skip-empty-report-plugin-config.xml
@@ -34,10 +34,10 @@ under the License.
         <artifactId>maven-pmd-plugin</artifactId>
         <configuration>
           <project 
implementation="org.apache.maven.plugins.pmd.stubs.CustomConfigurationMavenProjectStub"/>
-          
<outputDirectory>${basedir}/target/test/unit/empty-report/target/site</outputDirectory>
-          
<targetDirectory>${basedir}/target/test/unit/empty-report/target</targetDirectory>
+          
<outputDirectory>${basedir}/target/test/unit/skip-empty-report/target/site</outputDirectory>
+          
<targetDirectory>${basedir}/target/test/unit/skip-empty-report/target</targetDirectory>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/empty-report/java/</compileSourceRoot>
+            <compileSourceRoot>${basedir}</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
           <minimumTokens>100</minimumTokens>
diff --git 
a/src/test/resources/unit/empty-report/skip-empty-report-plugin-config.xml 
b/src/test/resources/unit/empty-report/skip-empty-report-plugin-config.xml
index 2aeff05..c0d4d4d 100644
--- a/src/test/resources/unit/empty-report/skip-empty-report-plugin-config.xml
+++ b/src/test/resources/unit/empty-report/skip-empty-report-plugin-config.xml
@@ -34,11 +34,11 @@ under the License.
         <artifactId>maven-pmd-plugin</artifactId>
         <configuration>
           <project 
implementation="org.apache.maven.plugins.pmd.stubs.CustomConfigurationMavenProjectStub"/>
-          
<outputDirectory>${basedir}/target/test/unit/empty-report/target/site</outputDirectory>
-          
<targetDirectory>${basedir}/target/test/unit/empty-report/target</targetDirectory>
-          
<rulesetsTargetDirectory>${basedir}/target/test/unit/empty-report/target/pmd/rulesets</rulesetsTargetDirectory>
+          
<outputDirectory>${basedir}/target/test/unit/skip-empty-report/target/site</outputDirectory>
+          
<targetDirectory>${basedir}/target/test/unit/skip-empty-report/target</targetDirectory>
+          
<rulesetsTargetDirectory>${basedir}/target/test/unit/skip-empty-report/target/pmd/rulesets</rulesetsTargetDirectory>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/empty-report/java/</compileSourceRoot>
+            <compileSourceRoot>${basedir}/java</compileSourceRoot>
           </compileSourceRoots>
           <inputEncoding>UTF-8</inputEncoding>
           <skipEmptyReport>true</skipEmptyReport>
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 bec142f..23e1e7e 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
@@ -40,14 +40,14 @@ under the License.
           <format>xml</format>
           <inputEncoding>UTF-8</inputEncoding>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/exclude-roots/src</compileSourceRoot>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/exclude-roots/baseroot/src1</compileSourceRoot>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/exclude-roots/baseroot/src2</compileSourceRoot>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/exclude-roots/othersrc</compileSourceRoot>
+            <compileSourceRoot>${basedir}/src</compileSourceRoot>
+            <compileSourceRoot>${basedir}/baseroot/src1</compileSourceRoot>
+            <compileSourceRoot>${basedir}/baseroot/src2</compileSourceRoot>
+            <compileSourceRoot>${basedir}/othersrc</compileSourceRoot>
           </compileSourceRoots>
           <excludeRoots>
-            
<excludeRoot>${basedir}/src/test/resources/unit/exclude-roots/baseroot</excludeRoot>
-            
<excludeRoot>${basedir}/src/test/resources/unit/exclude-roots/othersrc</excludeRoot>
+            <excludeRoot>${basedir}/baseroot</excludeRoot>
+            <excludeRoot>${basedir}/othersrc</excludeRoot>
           </excludeRoots>
         </configuration>
         <dependencies>
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 8393c5e..5fff1c9 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
@@ -39,6 +39,7 @@ under the License.
           <format>xhtml</format> <!-- format "xhtml" does not exist -->
           <linkXRef>false</linkXRef>
           
<xrefLocation>${basedir}/target/test/unit/invalid-format/target/site/xref</xrefLocation>
+          <compileSourceRoots>${basedir}</compileSourceRoots>
           <minimumTokens>25</minimumTokens>
         </configuration>
       </plugin>
diff --git 
a/src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml 
b/src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml
index e6ccad4..4b47ed4 100644
--- a/src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml
+++ b/src/test/resources/unit/invalid-format/invalid-format-plugin-config.xml
@@ -41,6 +41,9 @@ under the License.
           <linkXRef>false</linkXRef>
           
<xrefLocation>${basedir}/target/test/unit/invalid-format/target/site/xref</xrefLocation>
           <inputEncoding>ISO-8859-1</inputEncoding>
+            <compileSourceRoots>
+                <compileSourceRoot>${basedir}</compileSourceRoot>
+            </compileSourceRoots>
         </configuration>
       </plugin>
     </plugins>
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 40f087f..2b53aa5 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
@@ -42,7 +42,7 @@ under the License.
           <skipPmdError>true</skipPmdError>
           <renderProcessingErrors>false</renderProcessingErrors>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/processing-error/src</compileSourceRoot>
+            <compileSourceRoot>${basedir}/src</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
diff --git 
a/src/test/resources/unit/processing-error/pmd-processing-error-plugin-config.xml
 
b/src/test/resources/unit/processing-error/pmd-processing-error-plugin-config.xml
index f08cee4..0c3e7d7 100644
--- 
a/src/test/resources/unit/processing-error/pmd-processing-error-plugin-config.xml
+++ 
b/src/test/resources/unit/processing-error/pmd-processing-error-plugin-config.xml
@@ -41,7 +41,7 @@ under the License.
           <inputEncoding>UTF-8</inputEncoding>
           <skipPmdError>false</skipPmdError>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/processing-error/src</compileSourceRoot>
+            <compileSourceRoot>${basedir}/src</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>
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 55c8a4d..5a91ffc 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
@@ -41,7 +41,7 @@ under the License.
           <inputEncoding>UTF-8</inputEncoding>
           <skipPmdError>true</skipPmdError>
           <compileSourceRoots>
-            
<compileSourceRoot>${basedir}/src/test/resources/unit/processing-error/src</compileSourceRoot>
+            <compileSourceRoot>${basedir}/src</compileSourceRoot>
           </compileSourceRoots>
         </configuration>
       </plugin>


Reply via email to