Questions tagged [sbt-buildinfo]

sbt plugin to generate Scala source from your build definitions.

Usage

Add the following in your build.sbt:

buildInfoSettings

sourceGenerators in Compile <+= buildInfo

buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion)

buildInfoPackage := "hello"

This generates the following:

package hello

case object BuildInfo {
  val name = "helloworld"
  val version = "0.1-SNAPSHOT"
  val scalaVersion = "2.9.2"
  val sbtVersion = "0.12.0"
}
18 questions
69
votes
3 answers

Can I access my Scala app's name and version (as set in SBT) from code?

I am building an app with SBT (0.11.0) using a Scala build definition like so: object MyAppBuild extends Build { import Dependencies._ lazy val basicSettings = Seq[Setting[_]]( organization := "com.my", version := "0.1", …
Alex Dean
  • 15,575
  • 13
  • 63
  • 74
20
votes
1 answer

IntelliJ Idea sbt managed source file

I am using sbt-buildinfo plugin that generates Scala source from my build definitions, allowing me to reference project name, version, etc. from my Scala code. It does this by generating a file BuiltInfo.scala with the following contents: package…
Grega Kešpret
  • 11,827
  • 6
  • 39
  • 44
8
votes
2 answers

Can the runtime of a Heroku app know it's commit id?

I'd like the runtime of my Heroku app (Play/Scala, running on Heroku Cedar) to be able to report to me which git commit it was built from. Heroku apps are generally built by the slug compiler on Heroku's infrastructure - unfortunately, the slug…
Roberto Tyley
  • 24,513
  • 11
  • 72
  • 101
5
votes
2 answers

IntelliJ Idea can't resolve symbol that inside Scala managed sources (sbt-buildinfo)

I think it could be a problem that appeared in new versions, and can't be resolved as old versions, I got a Play Java project with sbt-buildinfo plugin the problem is really common is that IntelliJ keep saying it can't resolve that symbol And here…
Al-Mothafar
  • 7,949
  • 7
  • 68
  • 102
5
votes
1 answer

How to not watch a file for changes in Play Framework

On a Play Framework 2.2 project that is using sbt-buildinfo to create a BuildInfo.scala file when the project is compiled, how can build.sbt be configured so that Play Framework won't watch the BuildInfo.scala file for changes, and won't restart the…
Fernando Correia
  • 21,803
  • 13
  • 83
  • 116
4
votes
1 answer

sbt: generating shared sources in cross-platform project

Building my project on Scala with sbt, I want to have a task that will run prior to actual Scala compilation and will generate a Version.scala file with project version information. Here's a task I've came up with: lazy val generateVersionTask =…
GreyCat
  • 16,622
  • 18
  • 74
  • 112
4
votes
2 answers

sbt-buildinfo generated object cannot be referenced

I'm using the aforementioned sbt plugin to get the version of the app I'm working on. The project has sub-modules. Here is the main build.sbt ... lazy val abandon = (project in file(".")). aggregate(base, cli, gui). dependsOn(base, cli, gui). …
zaxme
  • 1,065
  • 11
  • 29
4
votes
0 answers

sbtbuildinfo - Building with multiple projects

I am using sbt to build a multi module project, and I want to use sbt-buildinfo to allow one of the services to have this info in it for debugging and versioning purposes. The problem with this, is that the sbt-buildinfo plugin seems to only take…
Stephen Carman
  • 999
  • 7
  • 25
4
votes
1 answer

How to access SBT settings from Java code in PlayFramework?

I have a PlayFramework application, and there is a name and version in the build.sbt. If I run the play console, I can access this information by typing name or version. How can I get this information from Java code inside the application? I can't…
Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
1
vote
0 answers

Conditional multi projects builds using sbt

I have multiple projects set up in a repo. Example - -root -project a -project b -project c -build.sbt Currently I am publishing all the projects separately, and as an assembled jar (containing all the projects). Can I do something…
saumj
  • 171
  • 1
  • 2
  • 11
1
vote
2 answers

sbt-buildinfo plugin: How can I add the java version in effect at compile time to the generated BuildInfo.scala?

The build info plugin is working fine for me, but I am wondering if I could add to the generated BuildInfo.scala source file the version of the JDK with which it was generated.
Igor Urisman
  • 717
  • 1
  • 6
  • 22
1
vote
0 answers

How to disable buildNumber increment in specific configurations?

I'm using the sbt-buildinfo plugin to track version number in my multiple-projects environment. The plugin is fine. But I want to increment buildNumber only in specific build, i.e. 'assembly' in 'production' configuration. Unfortunately, this value…
1
vote
1 answer

How can I ask sbt-buildinfo to run only at (re)load time and not compile time?

I use the sbt-buildinfo SBT plugin, which works great. I would like to improve the following thing: currently, all values in the generated file can only change if the whole sbt project is reloaded, and thus not at every compile run. I would…
Jean-Philippe Pellet
  • 59,296
  • 21
  • 173
  • 234
0
votes
0 answers

Generate build info source file in Maven project (similar to SBT Buildinfo)

I used to use https://github.com/sbt/sbt-buildinfo to generate source code files in my Scala project to access information such as the project version from within the code. SBT BuildInfo generates code that looks like the following: case object…
0
votes
1 answer

What is buildInfoPackage in sbt-buildinfo?

Consider I have a module named myservice which contains sub modules service1 and service2 myproject/ myservice/ / service1 /com/sample/process …
supernatural
  • 1,107
  • 11
  • 34
1
2