mvn checkstyle:checkstyle在使用报告时使用了错误的配置

Jan*_*ing 8 java checkstyle maven

我面临以下问题.我已使用以下配置设置了checkstyle:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>${checkstyle.plugin.version}</version>
            <inherited/>
            <configuration>
                <configLocation>${basedir}/checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
            </configuration>
        </plugin>
    </plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)

我跑的时候运行正常mvn site.但是,当我运行checkstyle mvn checkstyle:checkstyle以便更有效地获取XML报告时,checkstyle插件会失败以使用默认配置.当我将插件移动到<build>XML时,生成正确,但现在checkstyle报告不再包含在生成的站点中.

将报表插件设置为Checkstyle 的(当前)方式是什么,同时在相同配置下单独运行插件的能力是什么?

它真的是两次定义插件和配置的首选方式吗?

Jan*_*ing 4

好的,显然您应该将带有配置的插件添加到<build><reporting>