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>
相关推荐
码畜也有梦想1 天前
Maven中optional的作用
java·jenkins·maven
上官浩仁2 天前
springboot maven 多环境配置入门与实战
java·spring boot·maven
元直数字电路验证2 天前
新建Jakarta EE项目,Maven Archetype 选项无法加载出内容该怎么办?
java·maven
麦兜*2 天前
Docker 部署 MongoDB:单节点与副本集的最佳实践
java·spring boot·mongodb·spring cloud·docker·容器·maven
杨杨杨大侠3 天前
附录 1:🚀 Maven Central 发布完整指南:从零到成功部署
java·github·maven
nightunderblackcat3 天前
新手向:实现验证码程序
java·spring boot·spring·java-ee·kafka·maven·intellij-idea
代码雕刻家3 天前
3.1.Maven-课程介绍
java·maven
产幻少年3 天前
maven
java·maven
幻灵尔依4 天前
前端编码统一规范
javascript·vue.js·代码规范