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 小时前
SequenceGenerator高并发有序顺序号生成中间件 - 架构设计文档
java·后端·spring·中间件·架构·kafka·maven
码农刚子7 小时前
字符串拼接用“+”还是 StringBuilder?别再凭感觉写了
后端·代码规范
spencer_tseng11 小时前
ojdbc6-1.0.0.jar xmlworker-1.0.0.jar
java·maven·jar
朱一头zcy15 小时前
[IDEA不同版本中]配置完Maven后 重启/导入新项目就恢复默认配置(C盘.m2)的解决方案
经验分享·maven·intellij-idea
麦麦鸡腿堡15 小时前
JavaWeb_maven
java·开发语言·maven
道一云黑板报1 天前
技术拆解:AI低代码架构设计与全链路落地实现
人工智能·驱动开发·低代码·ai·企业微信·ai编程·代码规范
不吃香菜学java1 天前
苍穹外卖-新增菜品需求分析
java·spring boot·spring·tomcat·maven·ssm
smile_life_1 天前
使用idea查看maven依赖
java·maven·intellij-idea
CoovallyAIHub1 天前
Django 大佬亲授:8 个 Coding Agent 工程模式,重新定义程序员价值
程序员·测试·代码规范