SBT: external config file with values accessible in build.sbt
I have an sbt project of standard structure. I'd like to have file, which I could separate from my build and to specify there values for use in Build.scala or build.sbt (to omit spoiling repository with local configurations).
It may be plain .properties format or scala file, or typesafe config, or any other (common .sbt practice is most welcomed of course):
prop1=value1
prop2=42
.......
Is there common practice for this so values are accessible in sbt build files? I want to pass them as test arguments to keep off of build files themselves.
I had a similar problem. I created a github repository with the solution:
https://github.com/darkocerdic/sbt-config
Create a new file at project/resources/local.properties and add new values for values already in default.properties file.
local.properties file is in .gitignore so it will not propagate outside your local setup.
Look at build.sbt for example usage of defined properties.
This github project is not as narrowly focused as you requested, but I think it can do what you want and a bit more: https://github.com/mslinn/config
This is a test project: https://github.com/mslinn/configTest
链接地址: http://www.djcxy.com/p/19858.html