Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get values for settings from a build.sbt file

I'm trying to figure out how I can get the values for the settings from my build.sbt file. My sbt file looks like so...

name := "projectName"

organization := "com.organization"

version := "0.1.1"

scalaVersion := "2.11.7"

...

and so on. I need to able to get the value for name and version to use in other files in my application and I don't want to have to hardcode it. Is there a way to do this?

like image 862
Ryan Wilson Avatar asked Sep 16 '25 07:09

Ryan Wilson


1 Answers

Just use .value method for properties and macros magic would do the work. See for example:

version := scalaVersion.value

update: the information above was written under presumption that project means project/* files that describe the project.


If there is need to pass some information from build to the sources then the buildinfo sbt plugin may be used. See the project page for usage description.

like image 71
ayvango Avatar answered Sep 18 '25 11:09

ayvango