2016-11-17 144 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 
}