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>
相关推荐
卓怡学长5 小时前
m289在线交友系统
java·spring·tomcat·maven·intellij-idea·hibernate
不吃香菜学java14 小时前
苍穹外卖-删除菜品
java·spring boot·spring·tomcat·log4j·maven
方安乐16 小时前
ESLint代码规范(一)
前端·javascript·代码规范
学不完的16 小时前
ZrLog 博客系统部署指南(无 War 包版,Maven 构建 + 阿里云镜像优化)
java·linux·nginx·阿里云·maven
Re_zero17 小时前
throws 还是 try-catch?Code Review 里被我打回最多的异常处理
java·代码规范
小江的记录本18 小时前
【泛型】泛型:泛型擦除、通配符、上下界限定
java·windows·spring boot·后端·spring·maven·mybatis
拄杖忙学轻声码19 小时前
maven引入本地jar包示例(非仓库引入)
java·maven·jar
csdn5659738501 天前
Java打包时,本地仓库有jar 包,Maven打包却还去远程拉取
java·maven·jar
集成显卡2 天前
别局限于 Oh-My-Posh,试试 Rust 编写的 starship:极简超快且无限可定制的命令行提示符
程序员·代码规范·命令行
spencer_tseng2 天前
mvn install:install-file
maven