我运行了mvn checkstyle:checkstyle,但它没有使用我定制的checkstyle XML文件。
请告诉我如何使用我自己的检查样式文件,而不是默认的/现在配置为哪个?
发布于 2012-10-11 01:10:25
您需要在pom.xml中配置文件位置
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<configLocation><!-- Specify file here --></configLocation>
</configuration>
</plugin>
</plugins>
</build>检查this page以查看其他配置选项。
发布于 2012-12-23 20:43:01
对于最新版本的CheckStyle,这一点现已更改,您需要使用以下属性声明文件位置:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<properties>
<checkstyle.config.location><!-- Specify file here --></checkstyle.config.location>
</properties>
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</plugins>
</build>
</project>取自我关于如何编写自定义检查样式检查的示例:
http://blog.blundellapps.co.uk/create-your-own-checkstyle-check/
源代码在这里:
https://stackoverflow.com/questions/12823917
复制相似问题