build - Maven Checkstyle 插件创建空报告

标签 build maven-plugin maven-3 checkstyle

我们目前正在使用 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/

相关文章:

build - 命名构建步骤 - Jenkins 配置

android - Android将特定的构建警告视为错误,因此在Crashlytics映射文件上传失败时构建失败

maven-2 - Maven Exec 插件不读取配置

node.js - meteor 构建包没有响应

android - 如何在Unity项目中查找并修复android build失败 ':transformClassesWithMultidexlistForRelease'的源

maven - 依赖项和插件标签中的依赖项有区别吗?

maven-2 - Maven 插件测试入门

java - Maven 未下载插件

maven - 使用 maven-remote-resources-plugin 并指定 resourcesDirectory

java - 向 java maven 项目添加新组件