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>
相关推荐
聊浮游6 小时前
JAVA2026最新全套学习资料、学习路线
java·开发语言·jvm·mysql·spring·maven·idea
小林ixn7 小时前
TS 工具类型实战:Pick/Omit/Partial/Record 一次讲透,别再 Omit 反了
typescript·代码规范
典典分享指南1 天前
用指纹算法给文章去重:mid_signature 实战
jvm·maven·intellij-idea·jetty
counting money2 天前
SpringBoot 项目创建(IDEA不全,还需要修改)
java·spring boot·spring·maven
慌途L3 天前
Open Code Review 详解:阿里巴巴开源 AI 代码审查工具
ai·ocr·代码规范·code review·ai代码审查
bytemaster3 天前
GitLab CE 团队卡不住 commit 规范?我用一个全局 Hook 把整个公司拦下了
代码规范
编程令我快乐4 天前
maven部分构建参数讲解
java·maven
BIBI20494 天前
Windows 下 Maven 安装与 VSCode 配置
java·windows·vscode·maven·环境搭建·安装教程
东风破_5 天前
ESLint 是什么?为什么你的项目需要它?
前端·后端·代码规范
先吃饱再说5 天前
代码写得好不好,谁说了算?ESLint 如何让团队代码风格“自动统一”
代码规范·eslint