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>
相关推荐
广师大-Wzx20 小时前
JavaWeb:后端部分
java·开发语言·spring·servlet·tomcat·maven·mybatis
Csvn20 小时前
实用的 AI 辅助编程技巧和最佳实践
人工智能·代码规范
霑潇雨21 小时前
原生 Zookeeper 实现分布式锁案例
java·分布式·zookeeper·云原生·maven
ideal-cs1 天前
总结:生产环境Release、Snapshot两种包版本该如何管理与发布构建
java·maven·snapshot·release
Zephyr_01 天前
SQL,MyBatis-Plus,maven,Spring与VUE3
sql·spring·vue·maven·mybatis
Supersist2 天前
【设计模式03】使用模版模式+责任链模式优化实战
后端·设计模式·代码规范
她说可以呀2 天前
JWT令牌检验用户是否登录
java·spring boot·spring·java-ee·maven
MuYiLuck3 天前
01-spring-boot-autoconfig-principle
java·spring·maven·自动配置
Don.TIk3 天前
天机の学堂
java·spring boot·spring·maven·mybatis
JavinLu3 天前
用idea的后端,切换到qoder编辑器以及maven配置
maven·intellij-idea·ai编程·qoder