2015-10-29 18 views
0

一個CheckStyle的SuppressionFilter我想用相同的CheckStyle配置在SBThttps://github.com/etsy/sbt-checkstyle-plugin)和日食http://eclipse-cs.sf.net/如何定義在Eclipse和SBT

這從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 

抱怨我發現螞蟻此解決方案: How to define suppressions-definitions for checkstyle, that work with both ant and eclipse

但我新來的sbt,並不知道我defi如何在build.sbt中以這種方式創建一個變量,它將被checkstyle插件拾取。

我該怎麼辦?我想在eclipse中儘可能少地配置,因爲這將在每臺開發人員機器上完成。

感謝

+0

現在我有兩個checkstyle配置,一個用於sbt和一個用於eclipse。由於checkstyle配置很少改變,這並不是非常糟糕。只是不好.. – tim

回答

0

展望sbt-checkstyle-plugin code,我沒有看到設置properties支持。作爲一個解決方法,我會建議如下:

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

不幸的是sbt抱怨。 _org.xml.sax.SAXException:屬性$ {samedir}尚未設置._ – tim

相關問題