我的.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
等系统属性启用后才能看到它。有任何想法如何实现这样的分叉?
答案 0 :(得分:2)
只需有条件地分配您的子项目:
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
}