Skip to content

Instantly share code, notes, and snippets.

@nicocavallo
Last active November 19, 2015 08:38
Show Gist options
  • Save nicocavallo/de9e18aefe11fe85959a to your computer and use it in GitHub Desktop.
Save nicocavallo/de9e18aefe11fe85959a to your computer and use it in GitHub Desktop.
Example of sbt-buildinfo plugin using environment variables.
lazy val root = (project in file("."))
.enablePlugins(PlayScala, SbtLiquibase, BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion,
"buildNumber" -> Option(System.getenv("BUILD_NUMBER")).getOrElse("n/a"),
"gitCommit" -> Option(System.getenv("GIT_COMMIT")).getOrElse("n/a"),
"gitBranch" -> Option(System.getenv("GIT_BRANCH")).getOrElse("n/a")
),
buildInfoPackage := "picsolve.jenkins.metadata",
buildInfoOptions += BuildInfoOption.ToJson
)
// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
// Artifact Metadata & Properties
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
organization := "picsolve"
val artifactId = "us.sample"
name := artifactId
moduleName := artifactId
scalaVersion := "2.11.7"
// Dependencies
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
libraryDependencies ++= Seq(
ws,
cache,
specs2 % Test,
"pl.matisoft" %% "swagger-play24" % "1.4",
"com.typesafe.scala-logging" %% "scala-logging" % "3.1.0",
"com.typesafe.slick" %% "slick" % "3.0.0",
"com.typesafe.play" %% "play-slick" % "1.0.0",
"com.typesafe.slick" %% "slick-codegen" % "3.0.0",
"com.h2database" % "h2" % "1.3.176" % "test",
"net.codingwell" %% "scala-guice" % "4.0.0"
)
logLevel := Level.Warn
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0")
//BuildInfo
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.5.0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment