You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jacek Musial (Jira)" <ji...@apache.org> on 2020/11/10 20:48:00 UTC
[jira] [Created] (MPMD-310) Unable to find referenced rule
AvoidReassigningCatchVariables
Jacek Musial created MPMD-310:
---------------------------------
Summary: Unable to find referenced rule AvoidReassigningCatchVariables
Key: MPMD-310
URL: https://issues.apache.org/jira/browse/MPMD-310
Project: Maven PMD Plugin
Issue Type: Bug
Components: PMD
Affects Versions: 3.13.0
Environment: macOS Catalina 10.15.7, OpenJDK 11, Maven 3.6.3
Reporter: Jacek Musial
I am getting following error when running
{code:java}
mvn clean install{code}
{code:java}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd (default-cli) on project pmd-issue: Execution default-cli of goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd failed: Unable to find referenced rule AvoidReassigningCatchVariables; perhaps the rule name is mispelled? -> [Help 1]{code}
The rule I want to add ([https://pmd.github.io/latest/pmd_rules_java_bestpractices.html#avoidreassigningcatchvariables)] was added in PMD 6.27.0 and Maven PMD Plugin is using 6.29.0 version of PMD.
For this bug I have created very simple maven project with empty main java class and one ruleset "AvoidReassigningCatchVariables". Code is very simple. If you would prefer source code files as attachment, please let me know.
src/main/java/com/example/*Main.java*
{code:java}
package com.example;
public class Main { public static void main(String[] args) { } } {code}
src/pmd/*checks.xml*
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" name="All Java Rules">
<description>PMD rules for Currency Cloud</description>
<exclude-pattern>.*Test\.java</exclude-pattern>
<rule ref="category/java/bestpractices.xml/AvoidReassigningCatchVariables" /> </ruleset>
{code}
src/*pom.xml*
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>pmd-issue</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.java>11</version.java>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>${version.java}</targetJdk>
<failOnViolation>true</failOnViolation>
<skip>false</skip>
<rulesets>
<ruleset>src/pmd/checks.xml</ruleset>
</rulesets> </configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution> </executions>
</plugin> </plugins> </pluginManagement>
<resources>
<resource>
<directory>src/main/pmd</directory>
</resource> </resources> </build> </project>{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)