I'm trying to exclude our snapshot repositories for the release build in sbt.
Therefore I thought of a environment variable or system property to control the stage I'm in, since I want to use ivy range syntax (e.g. '[1.0.0,)' ) for released versions of our own libraries and don't want to include SNAPSHOT versions of these libs. This does not compile:
resolvers += {
val res : Seq[sbt.Resolver] = stage match {
case "dev" => Seq("Our Artifactory snapshots2" at "https://bla/artifactory/snapshots/")
case "release" => None
}
res
}
Is it possible to have conditionally added resolvers in sbt? Any advice would be appreciated. Thanks.
EDIT: I came to a solution, which is not very nice... I just add the releases a second time in the 'release' case:
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/"
You can simply write this:
resolvers ++= Seq(stage).collect {
case "dev" => "Our Artifactory snapshots2" at "https://bla/artifactory/snapshots/"
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments