Execution failed for task ':compileScala'. Unknown target 'jvm-1.8'


(mail) #1

Hi,

I’m very new to Gradle - just downloaded it (version 1.8-rc-1) a couple of days ago. I set up a simple Scala project, and got it compiling under Java 7. So far so good.

Then I installed the early access version of the Java 8 SDK on my machine. Since then, I’ve been encountering the following error:

“C:\Program Files\Java\jdk1.8.0\bin\java” -Dgradle.home=C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1 “-Dtools.jar=C:\Program Files\Java\jdk1.8.0\lib\tools.jar” -Didea.launcher.port=7535 “-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.4\bin” -Dfile.encoding=UTF-8 -classpath “C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\groovy-all-1.8.6.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-base-services-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-base-services-groovy-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-cli-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-core-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-docs-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-launcher-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-messaging-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-native-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-open-api-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-resources-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-tooling-api-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-ui-1.8-rc-1.jar;C:\Users\ekevcou.gradle\wrapper\dists\gradle-1.8-rc-1-bin\7ik0kqapnnkia9k55rjrppr59m\gradle-1.8-rc-1\lib\gradle-wrapper-1.8-rc-1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 12.1.4\lib\idea_rt.jar” com.intellij.rt.execution.application.AppMain org.gradle.launcher.GradleMain --build-file C:\Users\ekevcou\Projects\MyProject\build.gradle compileScala :compileJava UP-TO-DATE :compileScala FAILED

BUILD FAILED

Total time: 9.838 secs

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:compileScala’. > Unknown target ‘jvm-1.8’

I’ve done a Google search, but I’ve been unable to find any reference to this particular error.

My current build.gradle is below:

apply plugin: ‘scala’ apply plugin: ‘idea’

sourceCompatibility = ‘1.8’ targetCompatibility = ‘1.8’

repositories {

mavenCentral() }

dependencies {

compile ‘org.scala-lang:scala-library:2.11.0-M4’

compile ‘org.scalafx:scalafx_2.10:8.0.0-M1’

compile ‘com.typesafe.slick:slick_2.10:1.0.1’

compile ‘com.h2database:h2:1.3.173’

compile ‘com.github.seratch.reaktor:scct_2.10:0.2.001’ }

task wrapper(type: Wrapper) {

gradleVersion = ‘1.8-rc-1’ }

Thanks in advance for any suggestions on how to resolve the problem. I’m happy to provide further information if needed.

Kevin


(Peter Niederwieser) #2

Gradle itself shouldn’t be run with Java 8 at this time, as there are known incompatibilities (e.g. some of the underlying libraries don’t support Java 8 yet). Apparently, the Scala Ant task doesn’t yet support ‘jvm-1.8’ as a target either. You can try ‘tasks.withType(ScalaCompile) { scalaCompileOptions.useAnt = false }’, but I’m not sure if it will help.


(mail) #3

Hi Peter,

Your suggested workaround did get the program to compile. Thanks for the prompt response, it’s very much appreciated.

I take your point that in any case, Gradle should not be run with Java 8 yet; I was not aware.

Kevin