2014-07-23 61 views
0

我爲使用Play Framework編寫的項目使用sbt-scoverage插件。爲什麼sbt-scoverage報告java.lang.RuntimeException:JavaScript文件的重複映射?

我面臨着以下java.lang.RuntimeException: Duplicate mappings錯誤:

[scoverage]: Instrumentation completed [35097 statements] 
[scoverage]: Written instrumentation file [/Users/project/target/scala-2.10/scoverage-data/scoverage.coverage.xml] 
[scoverage]: Writing measurements data to [/Users/project/target/scala-2.10/scoverage-data] 
... 
[info] Compiling 49 Scala sources to /Users/project/target/scala-2.10/test-classes... 
java.lang.RuntimeException: Duplicate mappings: 
/Users/project/target/scala-2.10/scoverage-classes/services-main.js 
from 
/Users/project/target/scala-2.10/resource_managed/main/public/javascripts/global/services/services-main.js 
/Users/project/target/scala-2.10/resource_managed/main/public/javascripts/kiosk/global/services/services-main.js 
/Users/project/target/scala-2.10/scoverage-classes/global.min.css 
from...... 

我的猜測是,它試圖從某處target轉移service-main.jsscoverage-classes下。我不打算scoverage運行對任何JavaScript文件,所以我包括以下設置:

ScoverageKeys.excludedPackages in ScoverageCompile := ".views.;.javascripts.;.assets.;.js.;.resource_managed." 

它改變不了什麼 - 錯誤仍然存​​在。我如何指示scoverage忽略JavaScript文件?

+0

這是一個多模塊項目嗎? 'app/assets/javascripts' **和**'app/assets/javascripts/kiosk'文件夾下有'services-main.js'嗎? kiosk文件夾從哪裏來?你使用'sbt-rjs'嗎?那麼'project/plugins.sbt'呢? –

回答

0

這只是一個猜測,但值得追求的是檢查它是否解決了問題。

根據Exclude classes and packages

You can exclude classes from being considered for coverage measurement by providing semicolon-separated list of regular expressions.

The regular expressions are matched against the fully qualified class name, and must match the entire string to take effect.

Any matched classes will not be instrumented or included in the coverage report.

我想你使用正則表達式是不正確的,因爲他們不匹配,他們是沒有任何影響。使用.*.如下:

ScoverageKeys.excludedPackages in ScoverageCompile := ".*javascripts.*;.*\.js" 
0

此bug已被固定在1.0.0版本。請注意,配置已更改,因此請務必檢查自述文件(最值得注意的是,要運行的命令從sbt scoverage:test更改爲sbt coverage test,並且插件變成了自動插件,因此您不需要再添加instrumentSettings)。

https://github.com/scoverage/sbt-scoverage