注意点:
1.不要用maven 3.5 去构建否则构建总会报java.io.EOFException异常。(切记,可换其他版本去构建我换了3.1.1)
2.要在pom.xml文件中增加Checkstyle,FindBugs,PMD这三个插件
pom文件修改如下:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<xmlOutput>true</xmlOutput>
<!-- Optional directoryto put findbugs xdoc xml report -->
<!-- <xmlOutputDirectory>target/site</xmlOutputDirectory>-->
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
jenkins项目配置如下:
构建命令:
compile -D maven.test.skip=true clean compile findbugs:findbugs checkstyle:checkstyle pmd:pmd
最终效果图: