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>
相关推荐
电子科技圈7 小时前
IAR作为Qt Group独立BU携两项重磅汽车电子应用开发方案首秀北京车展
开发语言·人工智能·汽车·软件工程·软件构建·代码规范·设计规范
happymaker062617 小时前
Nexus私服的使用(配合Maven)
java·maven
阿丰资源17 小时前
基于SpringBoot+MySQL+Maven的图书推荐系统项目文档(附源码)
spring boot·mysql·maven
Fate_I_C1 天前
Android函数式编程代码规范文档
android·代码规范
lwf0061641 天前
Maven Wrapper 使用指南
maven
我登哥MVP2 天前
【SpringMVC笔记】 - 9 - 异常处理器
java·spring boot·spring·servlet·tomcat·maven
Fate_I_C2 天前
Kotlin 协程:串行/并行请求、async/await、coroutineScope 管理并发、重试机制
android·代码规范
MeAT ITEM2 天前
maven导入spring框架
数据库·spring·maven
chenxu98b2 天前
SpringBoot Maven 项目 pom 中的 plugin 插件用法整理
spring boot·后端·maven