我正在使用 Maven、Maven checkstyle 插件、Jenkins 和 Jenkins checkstyle 插件。
我总共有7个项目。 1 个父项目和 6 个子项目。
我有以下 3 种情况:
mvn clean site
命令 请给出解决方案
我的代码:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>../parent-project/checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
3.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
我所说的“不在 Jenkins 中工作”的意思是我在 Jenkins 中安装了 checkstyle 插件,在 Jenkins 工作中我选择了“发布 Checkstyle 分析结果”复选框。在场景 1 中,我能够在 jenkins 工作页面中看到 checkstyle 链接。如果我点击所有代码违规报告都会出现。在其他情况下 (2,3) Checkstyle 链接也没有出现。
最佳答案
刚刚找到解决方案。
在项目配置菜单中,在“目标和选项”字段中,您需要添加不带 ' 字符的“站点”。在我的“目标和选项”字段中,我有:全新安装。这没有运行 checkstyle。但后来我将其更改为:全新安装站点。现在 checkstyle 运行了!
希望这能解决您的问题。
编辑:
我的 pom.xml 扩展了标签:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
</plugin>
</plugins>
运行 checkstyle。尝试仅将其用于 checkstyle,然后再次运行该项目。
关于maven - Checkstyle 在 Maven 中工作,但在 Jenkins 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18947255/