Maven checkstyle 插件 - 检查目标找不到配置文件

Maven checkstyle plugin - check goal cannot find configuration file

我一直无法使用 checkstyle 检查目标。我收到以下错误:

Unable to find configuration file at location: ${project.parent.basedir}/.settings/my_checks.xml: Could not find resource '${project.parent.basedir}/.settings/my_checks.xml'.

我在使用命令 mvn checkstyle:check 时收到此错误,但如果我 运行 mvn checkstyle:checkstyle 会按预期找到并使用此配置文件。

插件配置如下图

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.17</version>
            <executions>
                <execution>
                    <goals>
                        <goal>check</goal>
                    </goals>
                    <phase>test</phase>
                </execution>
            </executions>           
        </plugin>   

...

    <properties>
        <checkstyle.config.location>${project.parent.basedir}/.settings/my_checks.xml</checkstyle.config.location>         
    </properties>

有什么建议吗?为什么 checkstyle 目标有效而 check 目标无效?

编辑:经过进一步审查,我了解到 ${project.parent.basedir} 在 运行 检查目标时没有解决。它在调用 checkstyle 目标时确实解决了。仍在寻找建议/解决方法...

我的解决方法是不再使用 ${project.parent.basedir} 变量并使用相对路径。这适用于我的情况,因为我所有的模块都是并行目录。

 <checkstyle.config.location>../parent/.settings/my_checks.xml</checkstyle.config.location>