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>
相关推荐
user_admin_god12 小时前
SSE 流式响应 Chunk 被截断问题的排查与修复
java·人工智能·spring boot·spring·maven·mybatis
小同志0017 小时前
⽅法注解 @Bean
java·spring·bean·maven
day day day ...19 小时前
Maven 项目中导入依赖的各种场景、方法、常见问题及解决办法
java·php·maven
python开发笔记20 小时前
Java(4) maven 结合spring 3 种框架设计架构
java·spring·maven
MY_TEUCK20 小时前
【Maven基础】Maven从安装配置到依赖管理与生命周期(可复现+避坑+面试)
java·面试·maven
Boop_wu2 天前
[Java EE进阶] 图书管理系统(2)
spring·java-ee·maven·mybatis·状态模式
Boop_wu2 天前
[Java EE 进阶]Mybatis进阶(动态SQL)
java·数据库·maven·mybatis
Jesse1212 天前
lint-staged与ls-lint配合使用时的陷阱
代码规范·命令行
雨声不在3 天前
家用版本maven的创建方法
java·maven
小毛驴8503 天前
命令行中使用 Maven 启动 Spring Boot 应用
java·spring boot·maven