In Maven you can have Profiles, which can set up a build configuration for different environments. For example DEV, QA, UAT, PRODUCTION
In order to support continuous integration, there must be a way to tell SBT which environment to run against.
how to set up for different environments in SBT. For example DEV, QA, UAT, PRODUCTION?
thanks
Then to easily add the environment variable, open the windows menu then type environment, and pick the first option: That takes you directly to the advanced system properties dialog: Then just pick Environment Variables, and paste the copied path in to your PATH.
sbt-package-dist is a plugin for sbt 0.11 which attempts to codify best practices for building, packaging, and publishing libraries and servers. It adds the following features: a "package-dist" task for creating a deployable distribution of a server, including an executable jar and a build.
The stage command is part of sbt-native-packager that: The goal [of the plugin] is to be able to bundle up Scala software built with SBT for native packaging systems, like deb, rpm, homebrew, msi. > help stage Create a local directory with all the files laid out as they would be in the final distribution.
You can do this by creating a custom configuration.
val ProfileDev = config("dev") extend(Runtime)
val ProfileQA = config("qa") extend(Runtime)
val root = (project in file(".")).
configs(ProfileDev, ProfileQA). // add config here!
settings(
name := "helloworld",
....
).
settings(inConfig(ProfileDev)(Classpaths.configSettings ++ Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / configuration.value.name / "resources"}
)): _*).
settings(inConfig(ProfileQA)(Classpaths.configSettings ++ Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / configuration.value.name / "resources"}
)): _*)
You then place your config file in src/dev/resources
and src/qa/resources
, and it should be part of your classpath when you say dev:run
or dev:package
. Here's a quick test:
object Main extends App {
println(xml.XML.load(this.getClass.getResource("/config.xml")))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With