maven 添加 checkstyle 插件约束代码规范

本例示例,是引用 http 链接这种在线 checkstyle.xml 文件的配置方式,如下示例:


    <properties>
        <maven.checkstyle.plugin.version>3.3.0maven.checkstyle.plugin.version>
        
        <checkstyle.config.location>http://xxx.test.com/repository/raw-hosted/scripts/checkstyle/checkstyle.xmlcheckstyle.config.location>
        
        <checkstyle.suppressions.location/>
    properties>
  
  
  
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-checkstyle-pluginartifactId>
                <version>${maven.checkstyle.plugin.version}version>
                <configuration>
                    <consoleOutput>trueconsoleOutput>
                    <violationSeverity>errorviolationSeverity>
                    <detail>truedetail>
                configuration>
                <executions>
                    <execution>
                        <id>checkstyleid>
                        <phase>validatephase>
                        <goals>
                            <goal>checkgoal>
                        goals>
                        <configuration>
                            <failOnViolation>truefailOnViolation>
                            <failsOnError>falsefailsOnError>
                        configuration>
                    execution>
                executions>
            plugin>
        plugins>
    build>

你可能感兴趣的:(Java开发,maven,代码规范)