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

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

    • 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
      

          [JENKINS-29414] pmd-plugin and checkstyle-plugin analysis doesn't work when using pmd:check

          krzyk added a comment -

          Do you have plans to support it in the near future, or is it a more long term?

          krzyk added a comment - Do you have plans to support it in the near future, or is it a more long term?

          Ulli Hafner added a comment -

          Actually no. In the long term I'm removing the special handling for maven projects anyway. The maven-plug-in has too many classloading problems... So maven jobs will then use the same code base as freestyle jobs.

          Ulli Hafner added a comment - Actually no. In the long term I'm removing the special handling for maven projects anyway. The maven-plug-in has too many classloading problems... So maven jobs will then use the same code base as freestyle jobs.

          Ulli Hafner added a comment -

          Released in 5.0.0-beta2.

          Ulli Hafner added a comment - Released in 5.0.0-beta2.

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

              Created:
              Updated:
              Resolved: