Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint")
initialize := {
val _ = initialize.value
if (sys.props("java.specification.version") != "1.8")
sys.error("Java 8 is required for this project.")
}
Using javacOptions ++= Seq("-source", "1.8", "-target", "1.8")
does not work if you have no Java sources.
But you can set the target JVM for the Scala compiler in build.sbt:
scalacOptions += "-target:jvm-1.7"