我在 checkstyle 配置中使用SuppressionFilter 。文件的路径suppression.xml是相对于 checkstyle-configuration 给出的,使用${samedir}( http://eclipse-cs.sourceforge.net/#!/properties )。原因:我将 eclipse 配置为使用远程 checkstyle-configuration:
<module name="SuppressionFilter">
<property name="file" value="${samedir}suppress.xml"/>
</module>
Run Code Online (Sandbox Code Playgroud)
我的 Gradle 构建脚本使用相同的 checkstyle 配置。不幸的是,gradle 的 checkstyle-plugin 似乎无法解析变量 ${samedir}。
有没有办法为 Eclipse 和 Gradle 使用相同的配置文件?我真的不想维护两个文件或在 Checkstyle 配置中使用绝对路径。