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>
相关推荐
无尽的沉默17 小时前
使用Spring Initializr 快速创建Maven管理的springBoot项目
spring boot·spring·maven
巴巴博一18 小时前
抛弃 ESLint + Prettier?基于 Biome + Husky 的下一代前端工程化实践
代码规范
苍煜1 天前
万字详解Maven打包策略:从基础插件到多模块实战
java·maven
2301_780029042 天前
支付宝sdk导入错误
java·开发语言·maven
缘空如是2 天前
java 构建代码推送maven 公共仓
java·开发语言·maven
Knight_AL2 天前
在 Windows 上安装本地 JAR 到 Maven 仓库
windows·maven·jar
爱敲代码的小鱼2 天前
Maven的简介:
java·maven
不会c+3 天前
Maven私服的搭建与使用
java·maven
_周游3 天前
Java8 API 文档搜索引擎_1. 项目简介与模块划分
java·搜索引擎·servlet·maven·intellij-idea
C澒3 天前
前端编码规范
前端·团队开发·代码规范