繁体   English   中英

如何在Eclipse和SBT中定义Checkstyle SuppressionFilter

[英]How to define a checkstyle SuppressionFilter in both eclipse and sbt

我想在sbthttps://github.com/etsy/sbt-checkstyle-plugin )和eclipsehttp://eclipse-cs.sf.net/ )中使用相同的checkstyle配置

这与SuppressionFilter分开工作,我可以定义文件,使其在eclipse中工作

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

然后sbt抱怨

org.xml.sax.SAXException: Property ${samedir} has not been set

或使其在sbt中起作用

<module name="SuppressionFilter">
    <property name="file" value="checkstyleExcludeFiles.xml"/>
</module>

然后日食抱怨

cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyleExcludeFiles.xml' in module SuppressionFilter

我为蚂蚁找到了这个解决方案: 如何为checkstyle定义抑制和定义,同时与ant和eclipse一起使用

但是我是sbt的新手,并且不知道如何以这种方式在build.sbt中定义一个变量,该变量将由checkstyle插件接收。

我能做什么? 我想在eclipse中配置得尽可能少,因为这必须在每台开发人员机器上完成。

谢谢

查看sbt-checkstyle-plugin代码 ,我看不到支持设置属性 作为一种解决方法,我建议以下内容:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM