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>
相关推荐
浙江第二深情26 分钟前
前端性能优化终极指南
java·maven
降临-max5 小时前
JavaWeb企业级开发---Ajax、
java·ajax·maven
何包蛋H5 小时前
Docker Maven 插件深度配置指南:Spotify vs Fabric8
docker·容器·maven
xUxIAOrUIII6 小时前
JWT和拦截器使用【附Maven中操作步骤】
java·maven
莫比乌斯环7 小时前
【日常随笔】Android 跳离行为分析 - Instrumentation
android·架构·代码规范
drebander7 小时前
macOS 下优雅管理 Maven:多版本切换 + settings.xml 自动切换(zsh-only 实战)
xml·maven
mike04127 小时前
Eclipse+maven+selenium自动化测试用例入门
selenium·eclipse·maven
摆烂z1 天前
maven中打包不打全部包+多线程打包
java·开发语言·maven
Talents1 天前
solidity中合约交易安全问题
代码规范
Talents1 天前
solidity中的错误处理
代码规范