5

试图清理我的${project.build.directory},我注意到maven-checkstyle-plugin将三个文件放入我的target文件夹checkstyle-checker.xml中:checkstyle-cachefilecheckstyle-result.xml.

我能够将最后两个重定向到他们自己的文件夹中target/checkstyle

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
      <cacheFile default-value="${project.build.directory}/checkstyle/checkstyle-cachefile"/>
      <configLocation>google_checks.xml</configLocation>
     [...]
      <outputFile default-value="${project.build.directory}/checkstyle/checkstyle-result.xml">${checkstyle.output.file}</outputFile>
    </configuration>
    [...]
    <executions>
      <execution>
        <phase>verify</phase>
        <goals>
          <goal>check</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

我能找到的所有信息checkstyle-checker都在propertiesLocation下。有说:

如果成功解析,属性位置的内容将被复制到 ${project.build.directory}/checkstyle-checker.properties 文件中,然后再传递给 Checkstyle 进行加载。

我可以更改将属性位置的内容复制到的位置吗?还是有另一种方法可以让插件将checkstyle-checker.xml文件写入我的自定义文件夹target/checkstyle

4

1 回答 1

2

${project.build.directory}/checkstyle-checker.properties如果不修改/覆盖插件,您将无法更改 的位置。

关于这一点,文档听起来很清楚。

凝视源代码会发现,这checkstyle-checker.properties是硬编码的。...并且路径(${project.build.directory})是“深入” maven/plexus。

同样适用于(位置)checkstyle-checker.xmlDefaultCheckstyleExecutor.java#L723

于 2021-11-10T15:42:59.250 回答