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>
相关推荐
何中应13 小时前
Maven项目没有Maven工具,IDEA没有识别到该项目是Maven项目怎么办?
java·后端·maven·intellij-idea
hqxstudying16 小时前
Java行为型模式---模板方法模式
java·开发语言·设计模式·代码规范·模板方法模式
甜鲸鱼18 小时前
在Maven多模块项目中进行跨模块的SpringBoot单元测试
spring boot·单元测试·maven
mrsk2 天前
每天一个小知识点,DRY究竟是什么?
前端·面试·代码规范
有梦想的攻城狮2 天前
快速搭建Maven仓库服务
java·maven·仓库·nexus
悟能不能悟2 天前
mvn能只test单独一个文件吗
maven
Rebecca.Yan2 天前
Maven下载与配置&&对Java项目的理解
java·开发语言·maven
慕木兮人可2 天前
idea安装maven 拉取依赖失败的解决办法
java·maven·intellij-idea
帅次3 天前
系统分析师-计算机系统-计算机系统概述&存储系统
系统架构·硬件架构·软件构建·个人开发·代码规范·设计规范
二饭3 天前
解决Maven“无法将类 XXXXX 中的构造器 XXXXXX 应用到给定类型”错误
java·spring·maven