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>
相关推荐
djgxfc14 小时前
简单了解Maven与安装
java·maven
Jarlen19 小时前
将本地离线Jar包上传到Maven远程私库上,供项目编译使用
java·maven·jar
ggdpzhk21 小时前
Mybatis 快速入门(maven)
oracle·maven·mybatis
老王笔记1 天前
Maven下载安装
maven
litGrey2 天前
Maven国内镜像(四种)
java·数据库·maven
尘浮生2 天前
Java项目实战II基于Java+Spring Boot+MySQL的大学城水电管理系统(源码+数据库+文档)
java·开发语言·数据库·spring boot·后端·mysql·maven
尘浮生2 天前
Java项目实战II基于Java+Spring Boot+MySQL的保密信息学科平台系统(源码+数据库+文档)
java·开发语言·数据库·spring boot·后端·mysql·maven
codelife3212 天前
Maven 项目无法下载某个依赖
java·maven
飞翔的佩奇2 天前
Java项目: 基于SpringBoot+mybatis+maven医院管理系统(含源码+数据库+任务书+开题报告+毕业论文)
java·数据库·spring boot·毕业设计·maven·mybatis·医院管理系统
知识的宝藏2 天前
maven pom文件中的变量定义
java·maven