2012-04-23 40 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