scala – SBT:对所有项目执行操作

前端之家收集整理的这篇文章主要介绍了scala – SBT:对所有项目执行操作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个包含多个子项目的SBT项目,即:

> projects
[info] In file:/home/me/src/foo/
[info]     popen
[info]     foobar-core
[info]   * foobar-client
[info]     foobar-db

有没有办法在每个子项目中运行一个动作?我正在寻找像publish-all这样的东西,因为我目前正在浏览所有子项目并手动运行发布,一旦有超过一些子项目,这将变得相当繁琐.

我正在使用sbt-0.11.2的惯性,但如果有帮助我愿意升级.

解决方法

您可以定义聚合所有其他项目的项目.此项目上运行的每个操作都将在所有聚合上运行.以下是 sbt wiki的示例:

import sbt._
import Keys._

object HelloBuild extends Build {
    lazy val root = Project(id = "hello",base = file(".")) aggregate(foo,bar)

    lazy val foo = Project(id = "hello-foo",base = file("foo"))

    lazy val bar = Project(id = "hello-bar",base = file("bar"))
}

猜你在找的Scala相关文章