You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It also didn't work in my project. I replaced it with following code in the build.sbt file:
lazy val generateBuildInfo = taskKey[Seq[File]]("Generates the build information")
generateBuildInfo := {
val file = (resourceManaged in Compile).value / "buildinfo.properties"
IO.write(file,
s"""
|version = ${version.value}
|scalaVersion = ${scalaVersion.value}
|sbtVersion = ${sbtVersion.value}
|builtAt = ${new Date()}
|builtAtMillis = ${System.currentTimeMillis()}
|""".stripMargin)
Seq(file)
}
resourceGenerators in Compile += generateBuildInfo
This will generate a buildinfo.properties file, which you can then read from the source code to get the desired values. I am sure it could be changed to generate the object directly, but this worked for me.
Also I noticed strange thing, src_managed directory wont be created if I build project using Intelij "Build project" button but If I compile project using "sbt compile" eveything is all right. Aren't they supposed to be the same ways of compiling the sbt project?
project/plugins.sbt
build.sbt
BuildInfo is never generated
The text was updated successfully, but these errors were encountered: