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>
相关推荐
赋范大模型技术社区6 小时前
【LangChain 实战】多智能体协作实现浏览器自动化丨Agents 运行流程丨多工具串&并联调用
架构·github·代码规范
goxingman6 小时前
关于使用idea打包的时候报错,Maven提示乱码java: �Ҳ�������
java·maven·intellij-idea
一碗谦谦粉20 小时前
Maven 依赖调解的两大原则
java·maven
清木青青1 天前
maven中的scope理解,你学会了吗?
maven
山有木兮木有枝_1 天前
JavaScript 设计模式--单例模式
前端·javascript·代码规范
hqxstudying1 天前
Java创建型模式---原型模式
java·开发语言·设计模式·代码规范
苦学编程的谢1 天前
Maven
java·maven·intellij-idea
考虑考虑1 天前
Maven 依赖范围(Scope)
java·后端·maven
halloweencai1 天前
使用commitlint+husky规范代码提交的信息格式
代码规范
肖魏眸1 天前
vue3 格式化 : antfu 组合 prettier & eslint & 提交格式化校验
前端·代码规范