You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ad...@apache.org on 2021/09/03 15:05:46 UTC

[maven-pmd-plugin] branch MPMD-308 updated: Remove now unnecessary maven-compat, fix test

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

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


The following commit(s) were added to refs/heads/MPMD-308 by this push:
     new 2a2e143  Remove now unnecessary maven-compat, fix test
2a2e143 is described below

commit 2a2e14346725877cc8badbc0add3f0e2045b4138
Author: Andreas Dangel <ad...@apache.org>
AuthorDate: Fri Sep 3 17:05:27 2021 +0200

    Remove now unnecessary maven-compat, fix test
---
 pom.xml                                                   |  6 ------
 .../maven/plugins/pmd/CpdViolationCheckMojoTest.java      | 15 ++++++++++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8cf6048..657f4ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -245,12 +245,6 @@ under the License.
 
     <!-- test -->
     <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-compat</artifactId>
-      <version>${mavenVersion}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.maven.plugin-testing</groupId>
       <artifactId>maven-plugin-testing-harness</artifactId>
       <version>${mavenVersion}</version>
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 081da74..730a30a 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java
@@ -42,13 +42,22 @@ public class CpdViolationCheckMojoTest
     public void testDefaultConfiguration()
         throws Exception
     {
+        File testPom =
+            new File( getBasedir(),
+                      "src/test/resources/unit/default-configuration/cpd-default-configuration-plugin-config.xml" );
+        final CpdReport mojo = (CpdReport) lookupMojo( "cpd", testPom );
+        mojo.execute();
+
+        // clear the output from previous pmd:cpd execution
+        CapturingPrintStream.init( true );
+
         try
         {
-            final File testPom =
+            testPom =
                 new File( getBasedir(),
                           "src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml" );
-            final CpdViolationCheckMojo mojo = (CpdViolationCheckMojo) lookupMojo( "cpd-check", testPom );
-            mojo.execute();
+            final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo( "cpd-check", testPom );
+            cpdViolationMojo.execute();
 
             fail( "MojoFailureException should be thrown." );
         }