通过Maven CLI识别CheckStyle错误

Kev*_*ith 13 checkstyle

我在命令行上通过mvn构建我的项目.

每当发生checkStyle错误时,我都会看到这种类型的输出:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-
plugin:2.4:checkstyle (default) on project myProject-server: 
An error has occurred in Checkstyle report generation. 
There are 2 checkstyle errors. -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

如何找出导致这些CheckStyle失败的代码行?

Sla*_*hin 14

CheckStyle将报告保存到target/checkstyle-result.xml(对于非模块化项目).所以你可以找到这个文件并检查它.

另一种情况是配置maven-checkstyle-plugin为向控制台显示所有此类警告/错误:

<consoleOutput>true</consoleOutput>
Run Code Online (Sandbox Code Playgroud)