maven 添加 checkstyle 插件约束代码规范

本例示例,是引用 http 链接这种在线 checkstyle.xml 文件的配置方式,如下示例:

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>
相关推荐
重生之后端学习1 天前
Maven基础
java·spring boot·spring·html·maven·mybatis
indexsunny2 天前
互联网大厂Java求职面试实战:Spring Boot与微服务在电商场景中的应用
java·数据库·spring boot·spring cloud·微服务·kafka·maven
逍遥德2 天前
如何学编程之02.理论篇.如何写出具有良好健壮性的代码?
java·开发语言·性能优化·代码规范·代码复审
Tinghui2 天前
Markdown常用标准语法
代码规范
番茄去哪了2 天前
苍穹外卖day03-----菜品管理
java·开发语言·数据库·ide·git·学习·maven
zhifou1234562 天前
Heic文件转jpg标准解决方案(libheif安装)
java·图像处理·github·maven·iphone
多多*3 天前
MySQL三大日志 binglog(历史档案) redolog(草稿本/记账本) undolog(后悔药)
java·开发语言·windows·spring·java-ee·maven·散列表
正是江南好时节3 天前
踩坑小记之闭包陷阱
前端·javascript·代码规范
SuperEugene3 天前
从 0-1 轻松学会 Vue3 Composables(组合式函数),告别臃肿代码,做会封装的优雅前端
vue.js·代码规范
爱敲代码的小鱼3 天前
Maven
android·java·maven