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>
相关推荐
zhz52148 小时前
后端代码规范文档示例
重构·bug·代码规范·结对编程
super_lzb12 小时前
springboot打war包时将外部配置文件打入到war包内
java·spring boot·后端·maven
小毛驴85015 小时前
Maven同时配置阿里云仓库和私有仓库
java·阿里云·maven
多米Domi01118 小时前
0x3f 第23天 黑马web (前端三件套,maven,web入门、mysql)黑马反射注解 hot100普通数组
java·python·mysql·算法·leetcode·maven
zhanjixun1 天前
Spring Boot Maven项目构建Docker镜像
spring boot·docker·maven
2501_941882482 天前
高可用数据库设计与分片策略在大规模系统中的实践分享
spring·maven
青衫码上行2 天前
Maven介绍和下载与安装
java·maven
计算机毕设指导62 天前
基于微信小程序的烧烤店点餐和结账系统【源码文末联系】
java·spring·微信小程序·小程序·tomcat·maven·intellij-idea
计算机毕设指导62 天前
基于微信小程序的养老服务系统【源码文末联系】
java·spring boot·微信小程序·小程序·tomcat·maven·intellij-idea
麦兜*2 天前
【SprintBoot】自定义 Spring Boot Starter 从入门到精通:封装企业级通用组件的最佳实践
java·jvm·spring boot·后端·spring·spring cloud·maven