2016-11-17 96 views
1

我有我的名.bst文件中的以下声明:隐藏的项目名.bst

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")) 

我想用默认值有项目3隐藏SBT(当然IntelliJ IDEA的项目),并且只有它可见通过像-Dproject3.enabled=true这样的系统属性启用它之后。任何想法如何实现这种分叉?

+1

我觉得SBT 0.13.13的合成项目功能可以在这种情况下使用:http://www.scala-sbt.org/0.13/docs/sbt -0.13科技-Previews.html#合成+子项目 – Haspemulator

回答

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 
}