user358603
user358603

Reputation:

Setting target JVM in SBT

How can I set target JVM version in SBT? In Maven (with maven-scala-plugin) it can be done as follows:

<plugin>
...
    <configuration>
      <scalaVersion>${scala.version}</scalaVersion>
      <args>
         <arg>-target:jvm-1.5</arg>
      </args>
    </configuration>
</plugin>

Upvotes: 13

Views: 9979

Answers (4)

Daenyth
Daenyth

Reputation: 37461

As of versions in 2023, the option is now -release instead of -target

Upvotes: 2

linehrr
linehrr

Reputation: 1748

you have to add(in your build.sbt file):

scalacOptions += "-target:jvm-1.8"

otherwise it won't work.

Upvotes: 4

Vasil Remeniuk
Vasil Remeniuk

Reputation: 20617

You can specify compiler options in the project definition:

javacOptions ++= Seq("-source", "1.8", "-target", "1.8") 

Upvotes: 20

marios
marios

Reputation: 8996

As suggested by others in comments, the current sbt version (1.0, 0.13.15) uses the following notation for setting source and target JVMs.

javacOptions ++= Seq("-source", "1.8", "-target", "1.8")

Upvotes: 1

Related Questions