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>
相关推荐
程序员钟霖6 小时前
【实战版】Spring IOC 控制反转详解
java·后端·spring·maven·intellij-idea
减瓦1 天前
Maven 源码包的下载与工程化落地
java·maven
脱胎换骨-军哥3 天前
C++ 代码规范与格式化指南
开发语言·c++·代码规范
KaneLogger3 天前
一套系统,让 AI 写代码的速度变成生产力
人工智能·程序员·代码规范
数聚天成DeepSData3 天前
数聚天成 DeepSData 数据价值落地实战指南
java·maven·devops
自强的小白4 天前
maven高级(聚合和私服)以及私服的上传和下载
java·maven
harmful_sheep4 天前
maven多版本包导致java.lang.NoClassDefFoundError
java·maven
正在走向自律4 天前
AI 辅助研发内部复盘(2/5):老项目改造的工程化实践
人工智能·ai编程·代码规范·ai辅助编程·老代码改造
用户40966601317516 天前
Lombok 你用对了吗?@Data 之外的 6 个隐藏神器
java·后端·代码规范
桦说编程7 天前
炮轰SDD:Spec驱动开发为何不适合绝大多数项目
llm·ai编程·代码规范