Skip to content

Instantly share code, notes, and snippets.

@ymasory
Created April 17, 2011 00:25
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ymasory/923640 to your computer and use it in GitHub Desktop.
Save ymasory/923640 to your computer and use it in GitHub Desktop.
detect Scala version at runtime
/** Use with a default value, for example:
* runningScalaVersion getOrElse "2.8.0"
*/
lazy val runningScalaVersion = {
val matcher = """version (\d+\.\d+\.\d+).*""".r
util.Properties.versionString match {
case matcher(versionString) => Some(versionString)
case _ => None
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment