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>
相关推荐
fumiguo1 小时前
一个绕不开的尴尬
代码规范
杨充3 小时前
10.可测试性实战设计
设计模式·开源·代码规范
杨充3 小时前
9.重构十二式的实战
设计模式·开源·代码规范
杨充3 小时前
8.反模式与坏味道
设计模式·开源·代码规范
梦梦代码精3 小时前
基于ThinkPHP6 + Vue3的家政预约系统全解析:从LBS定位到自动派单的完整实现
java·docker·开源·php·代码规范
行者全栈架构师5 小时前
混元 Hy3 Agent 实战:季度报告 3 小时变 40 分钟
算法·架构·代码规范
飞雪金灵5 小时前
mac电脑 Maven下载安装和配置环境变量
macos·maven·maven下载安装·mac电脑环境
.Hypocritical.1 天前
Maven笔记——2
java·笔记·maven
遨游DATA2 天前
Maven dependencyManagement 已声明却仍缺 Jar:如何验证最终运行包
java·spring boot·maven·故障排查·依赖管理
饼干哥哥2 天前
n8n 又活了?用 Codex把跨境电商工作流转成 Skill
人工智能·后端·代码规范