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>
相关推荐
KaneLogger12 小时前
AI 时代编程范式迁移的思考
人工智能·程序员·代码规范
天蓝色的鱼鱼6 天前
模块化与组件化:90%的前端开发者都没搞懂的本质区别
前端·架构·代码规范
会员源码网6 天前
尝试修改常量值(`Fatal error: Cannot re-assign auto-global variable _POST`)
编程语言·代码规范
晨米酱6 天前
四、Prettier 编辑器集成指南
前端·代码规范
会员源码网7 天前
闭包中未正确引用外部变量(遗漏`use ($var)`导致变量未定义)
程序员·代码规范
_志哥_10 天前
OpenSpec 技术指南:让AI编程助手更可靠
ai编程·代码规范
代码老中医11 天前
页面加载从3秒到0.8秒,我只做了这3件事
代码规范
七牛云行业应用11 天前
大模型接入踩坑录:被 Unexpected end of JSON 折磨三天,我重写了SSE流解析
javascript·人工智能·代码规范
漂流瓶jz11 天前
BEM、OOCSS、SMACSS、ITCSS、AMCSS、SUITCSS:CSS命名规范简介
前端·css·代码规范
逍遥德12 天前
Maven教程.02-基础-pom.xml 使用标签大全
java·后端·maven·软件构建