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私服(Nexus)
java·运维·maven
A懿轩A3 小时前
【Maven 构建工具】Maven + JUnit5 单元测试实战:测试级别、注解、断言与 Maven test 阶段
java·单元测试·maven
番茄去哪了1 天前
苍穹外卖day07---Redis缓存优化与购物车功能实现
java·数据库·ide·spring boot·spring·maven·mybatis
范什么特西1 天前
配置Maven准备工作
java·maven
范什么特西1 天前
Tomcat加Maven配置
java·tomcat·maven
百锦再1 天前
Spring Boot Web 后端开发注解核心
开发语言·spring boot·python·struts·spring cloud·kafka·maven
啊哈哈哈哈哈啊哈哈1 天前
Spring MVC 项目结构学习笔记
java·spring boot·spring·servlet·maven
vx-Biye_Design2 天前
servlet家政公司管理系统-计算机毕业设计源码01438
java·vue.js·spring·servlet·tomcat·maven·mybatis
珹洺2 天前
Java-servlet(五)手把手教你利用Servlet配置HTML请求与相应
java·运维·服务器·前端·servlet·html·maven
百锦再3 天前
Java中的char、String、StringBuilder与StringBuffer 深度详解
java·开发语言·python·struts·kafka·tomcat·maven