8
votes

How can I make the Maven PMD Plugin print the PMD errors that it finds to the console during a "mvn install"? Right now, the output is going into a pmd error file in the target dir. It looks like old version of the plugin supported the variable "maven.pmd.console", but the new one doesn't seem to.

New PMD plugin: http://maven.apache.org/plugins/maven-pmd-plugin/

Old PMD plugin variables: http://maven.apache.org/maven-1.x/plugins/pmd/properties.html

1
Have you checked -Dpmd.printFailingErrors=true ?khmarbaise
Thanks khmarbaise, that did it! I ended up just putting the option in configuration section of pmd in my pom.xml file, but I'm sure it does the same thing.HappyCoder86

1 Answers

12
votes

Just like khmarbaise said, the below configuration worked:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>${plugin.maven.pmd.version}</version>
        <configuration>
           <minimumTokens>100</minimumTokens>
           <targetJdk>${jdk.version}</targetJdk>
           <printFailingErrors>true</printFailingErrors>
           <rulesets>
              <ruleset>example_pmd.xml</ruleset>
           </rulesets>
        </configuration>
        <dependencies>
           <dependency>
              <groupId>com.example</groupId>
              <artifactId>example</artifactId>
              <version>${example.version}</version>
           </dependency>
        </dependencies>
     </plugin>