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>
相关推荐
San303 小时前
深入理解JavaScript执行机制:从变量提升到内存管理
javascript·编程语言·代码规范
Kent_J_Truman4 小时前
JDK Maven Tomcat Spring在VSCode中的部分配置细节(自用)
java·tomcat·maven
运维_攻城狮4 小时前
Nexus 3.x 私服搭建与运维完全指南(Maven 实战)
java·运维·maven
chxii4 小时前
Maven 详解(中)
java·maven
学到头秃的suhian13 小时前
Maven
java·maven
菩提树下种菩提13 小时前
Hadess零基础学习,如何管理Maven制品
maven·使用教程·hadess·国产开源制品管理工具·一文上手
小坏讲微服务13 小时前
Docker-compose 搭建Maven私服部署
java·spring boot·后端·docker·微服务·容器·maven
chxii13 小时前
Maven 详解(下)
java·maven
inferno13 小时前
Maven基础(二)
java·开发语言·maven
杨武博13 小时前
关于maven中pom依赖冲突问题记录
java·maven