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 8735673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:07:10+00:00 2026-06-13T10:07:10+00:00

I have a Java project that is built using Maven , thus my build

  • 0

I have a Java project that is built using Maven, thus my build process is defined in the pom.xml file of the project. My development team uses a variety of plugins to check the quality of our source code; one such plugin uses PMD to check the code.The plugin makes sure that PMD is run every time we execute mvn install on the project and it will fail the build if there is a violation. Here is the plugin in our pom.xml:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>2.7.1</version>
            <configuration>
                <targetJdk>1.6</targetJdk>
                <linkXref>false</linkXref>
                <failOnViolation>true</failOnViolation>
                <failurePriority>1</failurePriority>
                <rulesets>
                    <ruleset>config/pmd-rulesets.xml</ruleset>
                </rulesets>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

My problem is that there are some times — especially when I am in the middle of developing a task and I want to check out if my code builds, but before I am ready to submit my source code to the SCM for automatic build and release to others — when I will want to suppress PMD violations from failing my build. I know that one such solution is to go into the code and add annotations to suppress warnings (http://pmd.sourceforge.net/suppressing.html), but I believe that editing source code in this way just to suppress these violations is annoying and error-prone. Another thing I could do is edit my pom and comment out the PMD plugin. However, once again, I find changing a file that is essential to my overall application is annoying and error-prone.

The solution that my team desires for is one that allows us to simply pass in some sort of flag or argument into our mvn command to quickly tell the build process to skip the PMD plugin. For example, whenever we are running an install at a point in the development phase and we know that the integration tests will probably fail (like, a web service may not be active), we pass the -Dskip.integration.tests=true flag during mvn install. This is a much cleaner solution than having to edit our test files or change pom.xml. I am looking for a similar variable to allows us to quickly skip PMD violations. Thanks!

PS: I did my homework. The following two Stackoverflow questions did not contain my desired solution:

  • PMD with Maven – How to disable one rule within a ruleset?
  • PMD – How to exclude files from violation check
  • 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-06-13T10:07:13+00:00Added an answer on June 13, 2026 at 10:07 am

    Just declare failPmdOnViolation property in your pom.xml as true, specify that property in plugin settings instead of hardcoded constant and then you can override it by activating a special profile of from the command line. Or you can refer default expression for failOnViolation plugin property like mvn -Dpmd.failOnViolation=false install

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

Sidebar

Related Questions

I have a Java project that I build using an Ant script. I am
I have a Java application that is managed using Maven. The project involves the
I have a java/maven project that uses tango icons, so I'm using the following
I have recently just created Java project using Eclipse that requires 2 JAR files
i have a java ee project which has a text file that uses a
I have got a project that is using jni to connect java wrapper and
I'm working on a Java web project that uses Maven to build its artifacts.
I am working on a Java project using spring2 and Maven. I have already
I am using Maven 2.2.1. I have an enterprise java maven project which I
I have a maven java project in eclipse. I added a groovy file in

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.