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>
相关推荐
MaCa .BaKa14 小时前
44-校园二手交易系统(小程序)
java·spring boot·mysql·小程序·maven·intellij-idea·mybatis
卓怡学长16 小时前
m319个人网站的设计与实现
java·数据库·spring·tomcat·maven·intellij-idea
高志小鹏鹏16 小时前
告别“修复 bug”:让别人一眼看懂你的 Commit
git·github·代码规范
xuhaoyu_cpp_java20 小时前
Maven学习(一)
java·经验分享·笔记·学习·maven
卓怡学长21 小时前
m320基于Java的网络音乐系统的设计与实现
java·数据库·spring·tomcat·maven
计算机毕设指导61 天前
基于SpringBoot校园学生健康监测管理系统【源码文末联系】
java·spring boot·后端·spring·tomcat·maven·intellij-idea
某人辛木2 天前
Maven一步到位
java·maven
来自远方的老作者2 天前
第7章 运算符-7.5 比较运算符
开发语言·数据结构·python·算法·代码规范·比较运算符
Patrick_Wilson2 天前
你的 MR 超过 500 行了吗?——大型代码合并请求拆分实战指南
前端·代码规范·前端工程化
Gale2World2 天前
【进阶范式】多智能体协同:Superpowers 与子代理驱动开发
人工智能·代码规范