I'm using play 2.2 with Scala, how can I get version from build.sbt?
name := "project_name"
version := "0.2-SNAPSHOT"
play.Project.playScalaSettings
or how can I pass there value from another object?
Running the command, "sbt sbt-version" will simply output your current directory and the version number.
sbt : The sbt settings that describe building your application. /conf : Configuration files for your application. /project : Further build description information. /public : Where static, public assets for your application are stored. /test : Where your application's test code will be stored.
sbt . That file lists all the source files your project consists of, along with other information about your project. Sbt will read the file and then it knows what to do to compile the complete project. Besides managing your project, some build tools, including sbt, can automatically manage dependencies for you.
The project folder contains sbt configurations and settings, while src contains all your source code. sbt creates the target folder after you compile your code; it includes the JVM bytecode of your application.
I've added this to my build.sbt:
import com.typesafe.config._
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
version := conf.getString("app.version")
and in my application.conf:
app.version="0.2-SNAPSHOT"
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