Force semaphore to use Java 8

I have an sbt project which needs Java 8 to run. But the SemaphoreCI keeps running it in Java 7 and it fails:

[error] java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0

I used this but didn't help:

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

How can I force Semaphore to use Java 8?

Jon Skeet
people
quotationmark

The Semaphore Java documentation tells you how to do this:

Switching between Java versions is done by adding the following command to your build commands:

change-java-version <version>

Valid values for <version> are 1.7 or 7 for OpenJDK 7 and 1.8 or 8 for Oracle JDK 8.

So you need to run change-java-version 8 or change-java-version 1.8. The documentation also gives details of how to do this in a script.

people

See more on this question at Stackoverflow