我试图在sbt中为发布版本排除我们的快照存储库。
因此,我想到了一个环境变量或系统属性来控制阶段I,因为我想使用常春藤范围语法(例如' [1.0.0,]' )对于我们自己的库的已发布版本,并不想包含这些库的SNAPSHOT版本。 这不编译:
resolvers += {
val res : Seq[sbt.Resolver] = stage match {
case "dev" => Seq("Our Artifactory snapshots2" at "https://bla/artifactory/snapshots/")
case "release" => None
}
res
}
是否可以在sbt中添加有条件的解析器? 任何意见,将不胜感激。谢谢。
编辑:我找到了一个解决方案,这个问题不是很好......我只是在“发布”中第二次添加了这些版本。情况下:resolvers += {
val res : Seq[sbt.Resolver] = stage match {
case "dev" => Seq("Our Artifactory snapshots2" at "https://bla/artifactory/snapshots/")
case "release" => Seq("Our Artifactory release" at "https://bla/artifactory/releases/")
}
res
}
// here the releases repository is already added...
resolvers += "Our Artifactory release" at "https://bla/artifactory/releases/"
答案 0 :(得分:1)
你可以简单地写一下:
resolvers ++= Seq(stage).collect {
case "dev" => "Our Artifactory snapshots2" at "https://bla/artifactory/snapshots/"
}