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>
相关推荐
这个DBA有点耶5 小时前
MySQL字符集与排序规则深入:索引失效的隐蔽场景与排查方法
数据库·mysql·代码规范
咖啡八杯11 小时前
常量与枚举设计规范:HttpStatus 自定义 601 警告码
java·架构·代码规范
何中应1 天前
Maven 执行控制台中文乱码问题
java·maven·intellij-idea
long、涯1 天前
win10安装Maven3.9(图文版)
java·maven
这个DBA有点耶3 天前
从异步复制到MGR:MySQL复制机制的三层演进与选型框架
数据库·mysql·代码规范
kisshyshy3 天前
《从屎山到秩序:Vibe Coding 95 驾驭术全公开》
人工智能·代码规范·vibecoding
深圳老胡8 天前
STM32F407 控制 L6470 步进电机驱动 —— 控制过程简介
笔记·stm32·单片机·嵌入式硬件·代码规范
怕浪猫8 天前
ZCode 开源了来看看这是个什么东西
node.js·github·代码规范
2601_953824619 天前
基于SSM的水果超市管理系统
java·tomcat·maven
明月_清风9 天前
Maven 到底是什么?一篇文章搞懂 Java 项目构建与依赖管理
java·后端·maven