本例示例,是引用 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>