3

我正在将 sbt 0.7.x 构建脚本转换为 sbt 0.11.2。我正在编写一个任务来从子项目中收集各种 JAR。在旧版本中,部分任务执行以下操作:

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

我怎样才能在 sbt 0.11 中做同样的事情?

更新添加:

尤其是:

  • 如何编写依赖于设置/任务列表的任务?例如,我将如何编写一个依赖于子项目列表中所有 managedClasspaths 的任务(而不将其全部捆绑到一个元组中)。
  • 是否有特定范围来获取标记为或未标记为“提供”的托管 jar?
4

1 回答 1

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

查看委托,您会发现您可以将此任务范围限定为各种配置,例如compile

> 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))
于 2012-04-24T09:43:29.600 回答