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 2020/01/11 11:06:27 UTC

[maven-pmd-plugin] 01/01: [MPMD-295] - Maven PMD Plugin fails on Java 13: Unsupported targetJdk value '13'

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

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

commit 10f4eda12f5718c19541f1f9d00301def03694fa
Author: Christian Hujer <Ch...@nelkinda.com>
AuthorDate: Thu Jan 9 18:29:24 2020 +0530

    [MPMD-295] - Maven PMD Plugin fails on Java 13: Unsupported targetJdk value '13'
    
    * Bump PMD version to 6.19.0
    * Update documentation with supported targetJdk values
---
 pom.xml                                            |  2 +-
 src/it/MPMD-295-JDK13/invoker.properties           | 19 +++++
 src/it/MPMD-295-JDK13/pom.xml                      | 82 ++++++++++++++++++++++
 .../src/main/java/com/mycompany/app/App.java       | 25 +++++++
 .../src/main/java/com/mycompany/app/Foo.java       | 28 ++++++++
 src/it/MPMD-295-JDK13/verify.groovy                | 22 ++++++
 .../org/apache/maven/plugins/pmd/PmdReport.java    |  9 ++-
 7 files changed, 184 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 43c8bc3..9789b18 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@ under the License.
     <mavenVersion>3.0</mavenVersion>
     <doxiaVersion>1.7</doxiaVersion>
     <javaVersion>7</javaVersion><!-- Because PMD 5.4+ requires Java 7 -->
-    <pmdVersion>6.17.0</pmdVersion>
+    <pmdVersion>6.19.0</pmdVersion>
     <sitePluginVersion>3.7.1</sitePluginVersion>
     <projectInfoReportsPluginVersion>3.0.0</projectInfoReportsPluginVersion>
   </properties>
diff --git a/src/it/MPMD-295-JDK13/invoker.properties b/src/it/MPMD-295-JDK13/invoker.properties
new file mode 100644
index 0000000..b8338a7
--- /dev/null
+++ b/src/it/MPMD-295-JDK13/invoker.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.
+
+invoker.java.version = 13
+invoker.goals = clean verify
diff --git a/src/it/MPMD-295-JDK13/pom.xml b/src/it/MPMD-295-JDK13/pom.xml
new file mode 100644
index 0000000..b20a00c
--- /dev/null
+++ b/src/it/MPMD-295-JDK13/pom.xml
@@ -0,0 +1,82 @@
+<?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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins.pmd.it</groupId>
+  <artifactId>empty-rulests</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>my-app</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.8.0</version>
+          <configuration>
+            <target>13</target>
+            <source>13</source>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <skipPmdError>false</skipPmdError>
+          <skip>false</skip>
+          <failOnViolation>true</failOnViolation>
+          <failurePriority>4</failurePriority>
+          <targetJdk>13</targetJdk>
+          <sourceEncoding>UTF-8</sourceEncoding>
+          <minimumTokens>100</minimumTokens>
+          <excludes>
+            <exclude>**/*Bean.java</exclude>
+            <exclude>**/generated/*.java</exclude>
+          </excludes>
+          <excludeRoots>
+            <excludeRoot>target/generated-sources/stubs</excludeRoot>
+          </excludeRoots>
+          <rulesets/>
+        </configuration>
+        <executions>
+          <execution>
+            <id>default</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/App.java b/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/App.java
new file mode 100644
index 0000000..8e4972d
--- /dev/null
+++ b/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/App.java
@@ -0,0 +1,25 @@
+package com.mycompany.app;
+
+/*
+ * 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.
+ */
+
+public class App
+{
+
+}
diff --git a/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/Foo.java b/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/Foo.java
new file mode 100644
index 0000000..2a5a2bc
--- /dev/null
+++ b/src/it/MPMD-295-JDK13/src/main/java/com/mycompany/app/Foo.java
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+
+public class Foo
+{
+    public Foo( final ArrayList<String> foo )
+    {
+    }
+
+}
diff --git a/src/it/MPMD-295-JDK13/verify.groovy b/src/it/MPMD-295-JDK13/verify.groovy
new file mode 100644
index 0000000..1cd85d4
--- /dev/null
+++ b/src/it/MPMD-295-JDK13/verify.groovy
@@ -0,0 +1,22 @@
+
+/*
+ * 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.
+ */
+
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.exists()
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index b3c5135..3ab36ef 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -93,9 +93,14 @@ public class PmdReport
     extends AbstractPmdReport
 {
     /**
-     * The target JDK to analyze based on. Should match the source used in the compiler plugin. Valid values are
+     * The target JDK to analyze based on. Should match the source used in the compiler plugin. Valid values
+     * with the default PMD version are
      * currently <code>1.3</code>, <code>1.4</code>, <code>1.5</code>, <code>1.6</code>, <code>1.7</code>,
-     * <code>1.8</code>, <code>9</code>, <code>10</code>, <code>11</code>, and <code>12</code>.
+     * <code>1.8</code>, <code>9</code>, <code>10</code>, <code>11</code>, <code>12</code>, and <code>13</code>.
+     *
+     * <p> You can override the default PMD version by specifying PMD as a dependency,
+     * see <a href="examples/upgrading-PMD-at-runtime.html">Upgrading PMD at Runtime</a>.</p>
+     *
      * <p>
      *   <b>Note:</b> this parameter is only used if the language parameter is set to <code>java</code>.
      * </p>