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>
相关推荐
逍遥德10 小时前
skill模板-基于java maven项目
java·人工智能·自然语言处理·maven
白豆五17 小时前
使用 Docker 搭建 Maven 私服
docker·容器·maven
末代程序员_C17 小时前
Maven版本管控:多分支并行开发中的API版本管理之道
大数据·elasticsearch·maven
shjita17 小时前
maven涉及的配置
java·前端·maven
MuzySuntree17 小时前
Ubuntu 下 Maven 构建 Spring Boot 项目报错 release version 17 not supported 解决方案
spring boot·ubuntu·maven
金融小白数据分析之路17 小时前
java 打包exe maven 版本
java·开发语言·maven
QC班长1 天前
Maven公司私库配置踩坑点
java·服务器·maven·intellij-idea
Han.miracle2 天前
Spring Cloud + Nacos 环境切换与配置管理最佳实践
数据库·spring boot·spring cloud·maven
爱吃烤鸡翅的酸菜鱼2 天前
Maven中BOM(Bill of Materials)的使用详解
java·中间件·maven·源代码管理
我登哥MVP2 天前
【SpringMVC笔记】 - 10 - 拦截器(Interceptor)
java·spring boot·spring·servlet·tomcat·maven