我最近设置了 Jenkins,它设置为在每次提交后运行(Java)单元测试。这很好用。但是,我随后尝试添加对 PMD 的支持。
它运行成功,0 个单元测试错误,210 个 pmd 警告(这很奇怪,因为它说它在状态页面上完成了 0 个警告)
这是售出日志的最后一部分:
测试运行:99,失败:0,错误:0,跳过:0
[JENKINS] Recording test results
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener -
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - --- maven-jar-plugin:2.4:jar (default-jar) @ krunch ---
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-jar-plugin:2.4:jar (default-jar) @ krunch ---
[pool-1-thread-1] INFO org.codehaus.plexus.archiver.jar.JarArchiver - Building jar: /var/lib/jenkins/workspace/krunch/target/krunch-0.0.1-SNAPSHOT.jar
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - >>> maven-pmd-plugin:3.0.1:check (default) @ krunch >>>
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener -
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - --- maven-pmd-plugin:3.0.1:pmd (pmd) @ krunch ---
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-pmd-plugin:3.0.1:pmd (pmd) @ krunch ---
[PMD] Finding all files that match the pattern pmd.xml
[PMD] Parsing 1 files in /var/lib/jenkins/workspace/krunch/target
[PMD] Successfully parsed file /var/lib/jenkins/workspace/krunch/target/pmd.xml of module krunch with 210 warnings.
[CHECKSTYLE] No report found for mojo check
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - <<< maven-pmd-plugin:3.0.1:check (default) @ krunch <<<
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener -
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - --- maven-pmd-plugin:3.0.1:check (default) @ krunch ---
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - --- maven-pmd-plugin:3.0.1:check (default) @ krunch ---
[CHECKSTYLE] No report found for mojo check
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - BUILD FAILURE
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Total time: 1:58.654s
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Finished at: Fri Aug 16 14:19:47 UTC 2013
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - Final Memory: 38M/718M
[pool-1-thread-1] INFO hudson.maven.Maven3Builder$MavenExecutionListener - ------------------------------------------------------------------------
[JENKINS] Archiving /var/lib/jenkins/workspace/krunch/pom.xml to /var/lib/jenkins/jobs/krunch/modules/krunch$krunch/builds/2013-08-16_14-17-43/archive/krunch/krunch/0.0.1-SNAPSHOT/krunch-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/krunch/target/krunch-0.0.1-SNAPSHOT.jar to /var/lib/jenkins/jobs/krunch/modules/krunch$krunch/builds/2013-08-16_14-17-43/archive/krunch/krunch/0.0.1-SNAPSHOT/krunch-0.0.1-SNAPSHOT.jar
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 2:00.924s
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: Fri Aug 16 14:19:49 UTC 2013
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - Final Memory: 38M/717M
[pool-1-thread-1] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
channel stopped
Finished: FAILURE
这是我当前的 POM(抱歉弄乱了,我已经研究了一段时间了)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<executions>
<execution>
<configuration>
<source>1.7</source>
<target>1.6</target>
<compilerId>eclipse</compilerId>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-eclipse</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<goals>
<goal>check</goal>
<goal>cpd-check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<linkXRef>false</linkXRef>
<targetJdk>1.6</targetJdk>
<rulesets>
<ruleset>/rulesets/basic.xml</ruleset>
</rulesets>
</configuration>
</plugin>
</plugins>
</reporting>
*我查看了至少 200 个网页,但似乎找不到任何有效的文档。如果您需要更多/更少的信息,请告诉我。