2012-04-23 167 views
2

我正在將sbt 0.7.x構建腳本轉換爲sbt 0.11.2。我正在編寫一個任務,從子項目中收集各種JAR。在舊版本中,部分任務執行以下操作:訪問sbt子項目的managedClasspath

deployedProjects.foreach { 
    p: BasicScalaProject => 
    p.managedClasspath(config("compile")) --- p.managedClasspath(config("provided")) 
    // etc 
} 

我該怎麼做sbt 0.11中的等價物?

更新補充:

特別是:

  • 我如何編寫依賴的設置/任務列表中的任務?例如,我將如何編寫一個依賴於子項目列表中的所有managedClasspath的任務(沒有將其全部捆綁到一個元組中)。
  • 是否有一個特定的範圍來獲取已標記或未標記爲「已提供」的託管瓶子?

回答

0

在SBT 0.11.x有任務managedClasspath:

> inspect managed-classpath 
[info] Task: scala.collection.Seq[sbt.Attributed[java.io.File]] 
[info] Description: 
[info] The classpath consisting of external, managed library dependencies. 
[info] Provided by: 
[info] {file:/Users/heiko/tmp/test/}default-f3fb6c/compile:managed-classpath 
[info] Dependencies: 
[info] compile:classpath-configuration 
[info] compile:classpath-types 
[info] compile:update 
[info] Reverse dependencies: 
[info] compile:external-dependency-classpath 
[info] Delegates: 
[info] compile:managed-classpath 
[info] *:managed-classpath 
[info] {.}/compile:managed-classpath 
[info] {.}/*:managed-classpath 
[info] */compile:managed-classpath 
[info] */*:managed-classpath 
[info] Related: 
[info] test:managed-classpath 
[info] runtime:managed-classpath 

縱觀代表你看,你可以範圍這個任務交給各種配置,例如編譯

> show compile:managed-classpath 
[info] Updating {file:/Users/heiko/tmp/test/}default-f3fb6c... 
[info] Resolving org.scala-lang#scala-library;2.9.1 ... 
[info] Done updating. 
[info] ArraySeq(Attributed(/Users/heiko/.sbt/boot/scala-2.9.1/lib/scala-library.jar)) 
+0

感謝,但我仍然不知道到底如何實現我是什麼之後 - 我已經更新的問題,以更精確。 – 2012-04-24 13:26:27