Search code examples
eclipse-pluginpmdsuppress-warnings

PMD-Eclipse: How to set suppressmarker?


As the PMD docs say,

you can tell PMD to ignore a specific line by using the "NOPMD" marker

but

you can use whatever text string you want to suppress warnings

by using the command-line option -suppressmarker.

How can you set -suppressmarker when using the PMD-Eclipse plugin?


Solution

  • The PMD plugin for Eclipse doesn't contain all the options that the command line does. The easiest thing is to use //NOPMD and ignore the problem completely.

    Alternatively, you could use an Ant script to run PMD. You can set an Ant script to run as a builder for an Eclipse project if you want it to run automatically. You lose the Eclipse integration with this approach though. Looking at an HTML report rather than being able to click on the error seems like a big tradeoff just to use a different marker.