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>
相关推荐
QC班长2 小时前
Maven公司私库配置踩坑点
java·服务器·maven·intellij-idea
Han.miracle16 小时前
Spring Cloud + Nacos 环境切换与配置管理最佳实践
数据库·spring boot·spring cloud·maven
爱吃烤鸡翅的酸菜鱼16 小时前
Maven中BOM(Bill of Materials)的使用详解
java·中间件·maven·源代码管理
我登哥MVP16 小时前
【SpringMVC笔记】 - 10 - 拦截器(Interceptor)
java·spring boot·spring·servlet·tomcat·maven
菜菜小狗的学习笔记17 小时前
八股(八)Maven、Git、Docker
java·maven
电子科技圈1 天前
IAR作为Qt Group独立BU携两项重磅汽车电子应用开发方案首秀北京车展
开发语言·人工智能·汽车·软件工程·软件构建·代码规范·设计规范
happymaker06262 天前
Nexus私服的使用(配合Maven)
java·maven
阿丰资源2 天前
基于SpringBoot+MySQL+Maven的图书推荐系统项目文档(附源码)
spring boot·mysql·maven
Fate_I_C2 天前
Android函数式编程代码规范文档
android·代码规范