2
我有一個多項目的scalania
主項目以及exercises
和answers
(子)項目。每個配置的類路徑依賴不適用於SBT中的test-> test?
The scalania project託管在GitHub上。
我試圖建立一個SBT項目配置,其中測試類是exercises
項目的一部分,而answers
項目提供瞭解決方案。
我SBT的官方文檔中讀取Per-configuration classpath dependencies並在scalania
主體工程結束了以下配置:
lazy val exercises = project
lazy val answers = project.dependsOn(exercises % "test->test")
它似乎沒有工作,在test
執行我用得到:
> project answers
[info] Set current project to scalania-answers (in build file:/Users/jacek/oss/scalania/)
> test
[info] Passed: Total 0, Failed 0, Errors 0, Passed 0
[info] No tests to run for answers/test:test
[success] Total time: 1 s, completed Oct 27, 2013 1:06:51 AM
它,直到我改變answers/build.sbt
以下幾點:
scalaSource in Test := (scalaSource in LocalProject("exercises") in Test).value
現在工作正常。
> reload
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/oss/scalania/project
[info] Set current project to scalania-answers (in build file:/Users/jacek/oss/scalania/)
> project answers
[info] Set current project to scalania-answers (in build file:/Users/jacek/oss/scalania/)
> testOnly *s99.P01*
[info] Formatting 19 Scala sources {file:/Users/jacek/oss/scalania/}answers(test) ...
[info] Compiling 19 Scala sources to /Users/jacek/oss/scalania/answers/target/scala-2.10/test-classes...
[info] P01Spec
[info]
[info] P01 solution should
[info] + Find the last element of a list
[info]
[info]
[info] Total for specification P01Spec
[info] Finished in 151 ms
[info] 1 example, 0 failure, 0 error
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
[success] Total time: 74 s, completed Oct 27, 2013 1:09:07 AM
僅僅使用project.dependsOn(exercises % "test->test")
有什麼問題?我在構建配置中丟失了些什麼?
是,你必須在一個子項目'exercises'測試類的問題,你想運行他們在另一個子項目'答案',只是取決於'演習'? –
是的。這就是我喜歡用SBT中的慣用方式來挑選的問題。如果有這樣的方式,讓我知道@MarkHarrah。 –