Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-29414

pmd-plugin and checkstyle-plugin analysis doesn't work when using pmd:check

XMLWordPrintable

    • 5.0.0-beta2

      I have project configured with pmd:check run during verify phase:

                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-pmd-plugin</artifactId>
                          <version>3.4</version>
                          <configuration>
                              <rulesets>
                                  <ruleset>com/example/pmd.xml</ruleset>
                              </rulesets>
                              <linkXref>false</linkXref>
                              <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                              <targetJdk>${maven.compiler.target}</targetJdk>
                              <verbose>true</verbose>
                              <skip>false</skip>
                              <includeTests>true</includeTests>
                          </configuration>
                          <executions>
                              <execution>
                                  <id>check-pmd</id>
                                  <phase>verify</phase>
                                  <goals>
                                      <goal>check</goal>
                                  </goals>
                              </execution>
                          </executions>
      

      The above configuration automatically fails build when there is any pmd violation, additionally there is a pmd.xml file created in given modules target directory with description of violations.
      I've configured my build with 'mvn clean verify' and added pmd plugin (from analysis) to run always even when build fails. But after a test build with pmd violations plugin didn't notice them.

      More over I tested this with checkstyle plugin and there is the same problem, build fails because of checkstyle violation but plugin reports 0 warnings.

      Here's jenkins log for checkstyle plugin:

      [INFO] --- maven-checkstyle-plugin:2.15:check (check-sources) @ xyz-tcusers-model ---
      [INFO] Starting audit...
      /opt/app/jenkins/jobs/XYZ-master/workspace/ContentGenerator/model/xyz/xyz-tcusers-model/src/main/java/com/example/xyz/tcusers/service/TcUserService.java:37: 'if' child have incorrect indentation level 8, expected level should be 12.
      Audit done.
      [CHECKSTYLE] Parsing file /opt/app/jenkins/jobs/XYZ-master/workspace/ContentGenerator/model/xyz/xyz-tcusers-model/target/checkstyle-result.xml
      [CHECKSTYLE] Successfully parsed file /opt/app/jenkins/jobs/XYZ-master/workspace/ContentGenerator/model/xyz/xyz-tcusers-model/target/checkstyle-result.xml of module xyz-tcusers-model with 1 unique warning and 0 duplicates.
      [CHECKSTYLE] Computing warning deltas based on reference build #3555
      [PMD] No report found for mojo check
      [JENKINS] Archiving disabled
      

            drulli Ulli Hafner
            krzyk krzyk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: