Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:20:46+00:00 2026-05-30T01:20:46+00:00

I have PMD running via Maven 2. Right now I have all the rulesets

  • 0

I have PMD running via Maven 2. Right now I have all the rulesets in place to see what gets generated (see code below). I’m going through and fixing things that make sense to me to fix. However, there are cases such as in the “optimizations” ruleset where I want to keep the rule set, but disable just one of the rules within the rule set. In my case, I want to disable the “AvoidInstantiatingObjectsInLoopss” rule.

Here is the reporting section of my pom.xml

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jxr-plugin</artifactId>
            <version>2.3</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <linkXref>true</linkXref>
                <sourceEncoding>utf-8</sourceEncoding>
                <minimumTokens>${pmd.minimumTokens}</minimumTokens>
                <failOnViolation>${pmd.failOnViolation}</failOnViolation>
                <targetJdk>${projectTargetJdk}</targetJdk>

                <rulesets>
                    <!-- See the FAQ here: http://maven.apache.org/maven-1.x/plugins/pmd/faq.html -->
                    <!-- See the rule sets here: http://pmd.sourceforge.net/ (menu on the left has a Rule Sets section -->
                    <!-- Unused rule sets -->
                    <!-- <ruleset>/rulesets/naming.xml</ruleset> -->

                    <!-- Unable to find rule sets -->
                    <!-- <ruleset>/rulesets/emptycode.xml</ruleset> -->
                    <!-- <ruleset>rulesets/comments.xml</ruleset> -->
                    <!-- <ruleset>/rulesets/unnecessary.xml</ruleset> -->
                    <!-- <ruleset>/rulesets/logging.xml</ruleset> -->

                    <!-- used rule sets -->
                    <!-- http://pmd.sourceforge.net/rules/java/basic.html -->
                    <ruleset>/rulesets/basic.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/braces.html -->
                    <ruleset>/rulesets/braces.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/clone.html -->
                    <ruleset>/rulesets/clone.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/codesize.html -->
                    <ruleset>/rulesets/codesize.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/controversial.html -->
                    <ruleset>/rulesets/controversial.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/coupling.html -->
                    <ruleset>/rulesets/coupling.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/design.html -->
                    <ruleset>/rulesets/design.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/finalizers.html -->
                    <ruleset>/rulesets/finalizers.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/imports.html -->
                    <ruleset>/rulesets/imports.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/j2ee.html -->
                    <ruleset>/rulesets/j2ee.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/junit.html -->
                    <ruleset>/rulesets/junit.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/javabeans.html -->
                    <ruleset>/rulesets/javabeans.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/migrating.html -->
                    <ruleset>/rulesets/migrating.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/optimizations.html -->
                    <ruleset>/rulesets/optimizations.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/strictexception.html -->
                    <ruleset>/rulesets/strictexception.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/strings.html -->
                    <ruleset>/rulesets/strings.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/sunsecure.html -->
                    <ruleset>/rulesets/sunsecure.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/typeresolution.html -->
                    <ruleset>/rulesets/typeresolution.xml</ruleset>
                    <!-- http://pmd.sourceforge.net/rules/java/unusedcode.html -->
                    <ruleset>/rulesets/unusedcode.xml</ruleset>
                </rulesets>
            </configuration>
        </plugin>
    </plugins>
</reporting>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:20:47+00:00Added an answer on May 30, 2026 at 1:20 am

    The definition of the rules and its activation is on the ruleset files.
    As you have a copy of the files on the “rulesets” folder, just delete or comment the node on the ruleset file which contains the reference to the rule.
    In this case, “AvoidInstantiatingObjectsInLoops” (net.sourceforge.pmd.rules.optimization.AvoidInstantiatingObjectsInLoops) is an Optimization rule, so it’s likely to be in “/rulesets/optimizations.xml”.

    Just edit the file, look for the inclusion of the rule, and comment or delete the corresponding rule node.

    I don’t know the content of your files, so you could have the rule included more than one time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big Maven project that uses the PMD plugin for code quality
Using pmd-5.0.1. I have some custom rulesets: <target name=pmd> <condition property=rules.file else=${data}\pmdrules.xml,${data}\madcustompmdrules.xml> <isset property=rules.file/>
I have a build.gradle file which loads PMD (downloading it from upstream Maven), and
I have run the PMD plugin in Eclipse against my code and I'm getting
I have experimented with several different static analyzers for Java, notably Findbugs and PMD.
I have if (localName.equals(TaxName)) { but PMD says Position literals first in String comparisons
Guys, I wanted generate the pmd report while building the project so I have
We have rather large code base (150+ projects, 400000+ lines of Java code, some
I am using PMD to do code-review for my application. I am able to
I have a Java project that is built using Maven , thus my build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.