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 created issue -
          krzyk made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          krzyk made changes -
          Description Original: I have project configured with pmd:check run during verify phase:
          {code}
                          <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>
          {code}

          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.
          New: I have project configured with pmd:check run during verify phase:
          {code}
                          <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>
          {code}

          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:
          {code}
          [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
          {code}
          krzyk made changes -
          Summary Original: pmd-plugin analysis doesn't work when using pmd:check New: pmd-plugin and checkstyle-plugin analysis doesn't work when using pmd:check
          krzyk made changes -
          Component/s New: checkstyle-plugin [ 15512 ]
          Ulli Hafner made changes -
          Labels New: maven-plugin-support
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 164289 ] New: JNJira + In-Review [ 181581 ]
          Ulli Hafner made changes -
          Component/s New: findbugs-plugin [ 15496 ]
          Priority Original: Major [ 3 ] New: Minor [ 4 ]
          Ulli Hafner made changes -
          Link New: This issue is duplicated by JENKINS-38727 [ JENKINS-38727 ]
          Ulli Hafner made changes -
          Labels Original: maven-plugin-support New: analysis-core-2.0
          Ulli Hafner made changes -
          Epic Link New: JENKINS-49911 [ 188901 ]

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

              Created:
              Updated:
              Resolved: