我们目前正在使用 Tycho 将我们的 Eclipse RCP 应用程序迁移到 Maven 构建上。 一切都运行良好,所以我们想引入 Maven checkstyle 插件。 结构如下:
parent
- pom.xml
child1
- pom.xml
child2
- pom.xml
每个子项目都被配置为父项目的模块(反之亦然)。 我们这样配置 maven-checkstyle-plugin:
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
从 child1 项目启动 mvn clean install site 确实会创建 checkstyle-result.xml,但该文件为空。
任何提示这里出了什么问题吗?
最佳答案
这个: http://larsmartinle.wordpress.com/2011/01/22/getting-checkstyle-pmd-an-other-plugins-to-work-with-maven/ 可能对你有帮助
添加正确的源位置(而不是 Maven 默认的“src/main/java”)
..
<build>
<sourceDirectory>src</sourceDirectory>
..
关于build - Maven Checkstyle 插件创建空报告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9499964/