api / org.gradle.api.tasks / ScalaRuntime / getScalaVersion

getScalaVersion

open fun getScalaVersion(scalaJar: File): String

Determines the version of a Scala Jar file (scala-compiler, scala-library, scala-jdbc, etc.). If the version cannot be determined, or the file is not a Scala Jar file, null is returned.

Implementation note: The version is determined by parsing the file name, which is expected to match the pattern 'scala-[component]-[version].jar'.

Parameters

scalaJar - a Scala Jar file

Return
the version of the Scala Jar file