在Checkstyle插件中使用Gradle和Eclipse中的$ {samedir} [英] Using ${samedir} in Checkstyle-plugins for Gradle and Eclipse

查看:301
本文介绍了在Checkstyle插件中使用Gradle和Eclipse中的$ {samedir}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在checkstyle-configuration中使用了 SuppressionFilter 。使用 $ {samedir} (< a href =http://eclipse-cs.sourceforge.net/#!/properties =nofollow> http://eclipse-cs.sourceforge.net/#!/properties )。原因:我将eclipse配置为使用远程checkstyle-configuration:

I use a SuppressionFilter in my checkstyle-configuration. The path to the file suppression.xml is given relative to the checkstyle-configuration, using ${samedir} (http://eclipse-cs.sourceforge.net/#!/properties). Reason: I configured eclipse to use a remote checkstyle-configuration:

<module name="SuppressionFilter">
  <property name="file" value="${samedir}suppress.xml"/>
</module>

我的Gradle构建脚本使用了相同的checkstyle配置。不幸的是,gradle的checkstyle-plugin似乎无法解析变量$ {samedir}。

The same checkstyle-configuration is used by my Gradle build-script. Unfortunately, the checkstyle-plugin for gradle seems to be unable to resolve the variable ${samedir}.

有没有办法在Eclipse上使用相同的配置文件和Gradle?我真的不想维护两个文件或在Checkstyle配置中使用绝对路径。

Is there a way to anyway use the same config-file for Eclipse and Gradle? I really don't want to maintain two files or use an absolute path in the Checkstyle-configuration.

推荐答案

您可以手动设置

checkstyle {
    configFile = file("${rootDir}/build_dependencies/my_checks.xml")
    configProperties = [samedir: "${rootDir}/build_dependencies"]
}

来源:改编自 Maven版本

这篇关于在Checkstyle插件中使用Gradle和Eclipse中的$ {samedir}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆