本文主要是介绍maven 添加 checkstyle 插件约束代码规范,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
本例示例,是引用 http 链接这种在线 checkstyle.xml 文件的配置方式,如下示例:
<properties><maven.checkstyle.plugin.version>3.3.0</maven.checkstyle.plugin.version><!--支持本地绝对路径、本地相对路径、HTTP远程路径--><checkstyle.config.location>http://xxx.test.com/repository/raw-hosted/scripts/checkstyle/checkstyle.xml</checkstyle.config.location><!--这样配置suppressions规则设定需要排除不检查的文件--><checkstyle.suppressions.location/></properties><!--省略--><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-checkstyle-plugin</artifactId><version>${maven.checkstyle.plugin.version}</version><configuration><consoleOutput>true</consoleOutput><violationSeverity>error</violationSeverity><detail>true</detail></configuration><executions><execution><id>checkstyle</id><phase>validate</phase><goals><goal>check</goal></goals><configuration><failOnViolation>true</failOnViolation><failsOnError>false</failsOnError></configuration></execution></executions></plugin></plugins></build>
这篇关于maven 添加 checkstyle 插件约束代码规范的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!