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>
相关推荐
卓怡学长9 小时前
m280本科生导师指导平台
java·数据库·spring·tomcat·maven·intellij-idea
卓怡学长11 小时前
m277基于java web的计算机office课程平台设计与实现
java·spring·tomcat·maven·hibernate
dreamxian14 小时前
苍穹外卖day09
java·spring boot·tomcat·log4j·maven
jessecyj15 小时前
maven导入spring框架
数据库·spring·maven
卓怡学长15 小时前
m281基于SSM框架的电脑测评系统
java·数据库·spring·tomcat·maven·intellij-idea
百锦再1 天前
Java 并发编程进阶,从线程池、锁、AQS 到并发容器与性能调优全解析
java·开发语言·jvm·spring·kafka·tomcat·maven
spencer_tseng2 天前
java.lang.ClassNotFoundException: org.slf4j.Logger
java·spring·maven
晨陌y2 天前
Maven完整配置教程:从零基础到实战,新手零踩坑
java·maven
福运常在2 天前
股票数据API(14)股票近年增发数据
java·python·maven
大傻^2 天前
Spring AI Alibaba 项目初始化:Maven依赖与YAML配置全解析
人工智能·spring·maven·springai·springaialibaba·评估框架