Author: mfriedenhagen
Date: Wed Nov  5 22:21:28 2014
New Revision: 1636987

URL: http://svn.apache.org/r1636987
Log:
MPMD-191: Update to PMD 5.2.1

* Because PMD now comes with multiple moduls depending on the language
  we must not only update the version.
* The API for detecting languages was changed as well.
* Additionally, rules in PMD do not end on `Rule` anymore, so
  custom configurations need to be adapted as well.

Modified:
    maven/plugins/trunk/maven-pmd-plugin/pom.xml
    maven/plugins/trunk/maven-pmd-plugin/src/it/empty-rulesets/pom.xml
    
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
    
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
    
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml

Modified: maven/plugins/trunk/maven-pmd-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/pom.xml?rev=1636987&r1=1636986&r2=1636987&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-pmd-plugin/pom.xml Wed Nov  5 22:21:28 2014
@@ -86,7 +86,7 @@ under the License.
     <javaVersion>1.6</javaVersion>
     <maven.compiler.source>${javaVersion}</maven.compiler.source>
     <maven.compiler.target>${javaVersion}</maven.compiler.target>
-    <pmdVersion>5.1.2</pmdVersion>
+    <pmdVersion>5.2.1</pmdVersion>
     <sitePluginVersion>3.3</sitePluginVersion>
     <mavenPluginVersion>3.2</mavenPluginVersion>
     <projectInfoReportsPluginVersion>2.7</projectInfoReportsPluginVersion>
@@ -117,7 +117,6 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
       <artifactId>maven-plugin-annotations</artifactId>
-      <version>${mavenPluginVersion}</version>
       <scope>provided</scope>
     </dependency>
 
@@ -175,15 +174,23 @@ under the License.
     <!-- pmd -->
     <dependency>
       <groupId>net.sourceforge.pmd</groupId>
-      <artifactId>pmd</artifactId>
+      <artifactId>pmd-core</artifactId>
+      <version>${pmdVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.pmd</groupId>
+      <artifactId>pmd-java</artifactId>
+      <version>${pmdVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.pmd</groupId>
+      <artifactId>pmd-javascript</artifactId>
+      <version>${pmdVersion}</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sourceforge.pmd</groupId>
+      <artifactId>pmd-jsp</artifactId>
       <version>${pmdVersion}</version>
-      <!-- Workaround to fix http://jira.codehaus.org/browse/MPLUGIN-221 -->
-      <exclusions>
-        <exclusion>
-          <groupId>com.ibm.icu</groupId>
-          <artifactId>icu4j</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
 
     <!-- test -->

Modified: maven/plugins/trunk/maven-pmd-plugin/src/it/empty-rulesets/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/it/empty-rulesets/pom.xml?rev=1636987&r1=1636986&r2=1636987&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/it/empty-rulesets/pom.xml 
(original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/it/empty-rulesets/pom.xml Wed Nov  
5 22:21:28 2014
@@ -46,13 +46,6 @@ under the License.
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-pmd-plugin</artifactId>
         <version>@project.version@</version>
-        <dependencies>
-          <dependency>
-            <groupId>net.sourceforge.pmd</groupId>
-            <artifactId>pmd</artifactId>
-            <version>5.0.5</version>
-          </dependency>
-        </dependencies>
         <configuration>
           <skipPmdError>false</skipPmdError>
           <skip>false</skip>

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=1636987&r1=1636986&r2=1636987&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
 Wed Nov  5 22:21:28 2014
@@ -28,6 +28,7 @@ import net.sourceforge.pmd.RuleSetFactor
 import net.sourceforge.pmd.RuleSetReferenceId;
 import net.sourceforge.pmd.benchmark.Benchmarker;
 import net.sourceforge.pmd.benchmark.TextReport;
+import net.sourceforge.pmd.lang.LanguageRegistry;
 import net.sourceforge.pmd.lang.LanguageVersion;
 import net.sourceforge.pmd.renderers.CSVRenderer;
 import net.sourceforge.pmd.renderers.HTMLRenderer;
@@ -524,7 +525,7 @@ public class PmdReport
 
         if ( null != targetJdk )
         {
-            languageVersion = LanguageVersion.findByTerseName( "java " + 
targetJdk );
+            languageVersion = LanguageRegistry.findLanguageVersionByTerseName( 
"java " + targetJdk );
             if ( languageVersion == null )
             {
                 throw new MavenReportException( "Unsupported targetJdk value 
'" + targetJdk + "'." );
@@ -532,7 +533,7 @@ public class PmdReport
         }
         else if ( "javascript".equals( language ) || "ecmascript".equals( 
language ) )
         {
-            languageVersion = LanguageVersion.ECMASCRIPT;
+            languageVersion = LanguageRegistry.findLanguageVersionByTerseName( 
"ecmascript" );
         }
         if ( languageVersion != null )
         {

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java?rev=1636987&r1=1636986&r2=1636987&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/test/java/org/apache/maven/plugin/pmd/PmdReportTest.java
 Wed Nov  5 22:21:28 2014
@@ -191,7 +191,8 @@ public class PmdReportTest
         String str = readFile( new File( getBasedir(), 
"target/test/unit/custom-configuration/target/site/pmd.html" ) );
         assertTrue(str.toLowerCase().contains("Avoid using if statements 
without curly braces".toLowerCase()));
 
-        assertTrue(
+        // Must be false as IfElseStmtsMustUseBraces is excluded!
+        assertFalse(
                 str.toLowerCase().contains("Avoid using if...else statements 
without curly braces".toLowerCase()));
 
         assertTrue( "unnecessary constructor should not be triggered because 
of low priority",

Modified: 
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml?rev=1636987&r1=1636986&r2=1636987&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
 (original)
+++ 
maven/plugins/trunk/maven-pmd-plugin/src/test/resources/unit/custom-configuration/resources/rulesets/custom.xml
 Wed Nov  5 22:21:28 2014
@@ -23,8 +23,9 @@ under the License.
   xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd";>
   <description>Just the braces rules I like</description>
   <rule ref="rulesets/java/braces.xml">
-    <exclude name="WhileLoopsMustUseBracesRule"/>
-    <exclude name="IfElseStmtsMustUseBracesRule"/>
+    <!-- as of PMD 5.2.0 rules do not end in Rule anymore -->
+    <exclude name="WhileLoopsMustUseBraces"/>
+    <exclude name="IfElseStmtsMustUseBraces"/>
   </rule>   
   
   <description>Lowest priority for unnecessary constructor</description>


Reply via email to