【问题标题】:Hide Projects in .sbt在 .sbt 中隐藏项目
【发布时间】:2016-11-22 06:52:44
【问题描述】:

我的 .sbt 文件中有以下声明:

lazy val root = (Project("core", file("."))
    aggregate(project1, project2)
    settings (...))
lazy val project1 = Project("project1", file("project1"))
lazy val project2 = Project("project2", file("project2"))
lazy val project3 = Project("project3", file("project3"))

我希望默认情况下将 project3 隐藏到 sbt(当然还有 Intellij IDEA 项目),并且只有在通过像 -Dproject3.enabled=true 这样的系统属性启用它之后才能看到它。任何想法如何实现这种分叉?

【问题讨论】:

标签: intellij-idea sbt


【解决方案1】:

只需有条件地分配您的子项目:

lazy val project3 = if (System.getProperty("project3.enabled") == "true") {
  Project("project3", file("project3"))
} else {
  // This is just a cheat to get the type system working. There might be
  // a cleaner way to do this.
  root
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多