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>
相关推荐
福运常在40 分钟前
股票数据API(21)如何获取股票指数最新分时交易数据
java·python·maven
Riu_Peter13 小时前
【技术】Maven 配置 settings.xml 轮询下载
xml·java·maven
中国胖子风清扬1 天前
实战:基于 Camunda 8 的复杂审批流程实战指南
java·spring boot·后端·spring·spring cloud·ai·maven
zb200641201 天前
Spring Boot spring-boot-maven-plugin 参数配置详解
spring boot·后端·maven
圣光SG1 天前
Maven 学习笔记(基础入门版)
笔记·maven
deelless1 天前
IDEA maven项目添加本地jar包
maven·intellij-idea·jar
Dylan的码园1 天前
maven入门与核心功能介绍
java·maven
福运常在1 天前
股票数据API如何获取(20)炸板股池数据
java·python·maven
Skilce2 天前
ZrLog 博客系统部署指南(无 War 包版,Maven 构建 + 阿里云镜像优化)
java·阿里云·maven
hbstream2 天前
我让 Claude 和 Codex 同时审计 26 个模块,它们只在 10 个上达成共识
ai编程·代码规范