【发布时间】:2016-08-18 22:02:03
【问题描述】:
我一直无法使用 checkstyle 检查目标。我收到以下错误:
无法在以下位置找到配置文件: ${project.parent.basedir}/.settings/my_checks.xml:找不到 资源'${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 目标时确实解决了。仍在寻找建议/解决方法...
【问题讨论】:
-
这只是发生在我身上。原因是我在main pom.xml中更新了版本号,却忘记在modules的pom文件中更新了
标签: maven checkstyle