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>
相关推荐
UIUV5 小时前
JavaScript流式输出技术详解与实践
前端·javascript·代码规范
invicinble5 小时前
关于maven的全域理解
java·spring boot·maven
-大头.6 小时前
2025 Maven终极实战:AI与云原生构建新范式
人工智能·云原生·maven
计算机毕设指导66 小时前
基于微信小程序的篮球场馆预订系统【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·tomcat·maven
南河的南6 小时前
解决IDEA无法下载Maven仓库的源码
java·maven·intellij-idea
琢瑜1 天前
问题1:Oracle Java路径干扰。问题2:环境变量加载顺序问题
java·maven
0和1的舞者1 天前
API交互:前后端分离开发实战指南
java·spring·tomcat·web3·maven·springmvc·springweb
❀͜͡傀儡师1 天前
maven 仓库的Central Portal Namespaces 怎么验证
java·maven·nexus
qq_2153978971 天前
java 依赖包引入本地maven库
java·maven
IDOlaoluo1 天前
apache-maven-3.9.9-bin.zip 使用步骤(超简单版)
java·maven·apache