我在 maven 2 中使用 checkstyle 插件。我现在想要将我的配置文件从默认文件切换为 a) 在线文件,或 b) 本地文件。我尝试了以下两件事,但都不起作用。有什么建议么?
A) 本地文件,直接位于我的项目文件夹中的 pom.xml 旁边
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugin>
B) 远程文件,存储在服务器上
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>http://stud.hs-heilbronn.de/~nischmid/development/checkstyle-config.xml</configLocation>
</configuration>
</plugin>
这两种情况都会导致如下错误:
[信息] 发生错误
Checkstyle报告生成。嵌入式
错误:检查样式期间失败
执行找不到资源
'文件:checkstyle.xml'。
任何帮助,将不胜感激!
我见过几个相关的问题configLocation
in Jira http://jira.codehaus.org/browse/MCHECKSTYLE使用 2.5 版本的插件(例如MCHECKSTYLE-129 http://jira.codehaus.org/browse/MCHECKSTYLE-129 or MCHECKSTYLE-131 http://jira.codehaus.org/browse/MCHECKSTYLE-131),a) 和 b) 都可以在 2.4 版本中正常工作。
因此,除非您使用 Maven 3,否则我建议暂时回滚到 2.4:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
</plugins>
or
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version>
<configuration>
<configLocation>http://stud.hs-heilbronn.de/~nischmid/development/checkstyle-config.xml</configLocation>
</configuration>
</plugin>
作为旁注,对于多模块构建,请查看多模块配置 http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/multi-module-config.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)