This message was deleted.
# community-support
s
This message was deleted.
v
Copy code
java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_11
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(11))
    }
}
t
If you can, prefer using
--release
though:
Copy code
tasks {
  compileJava {
    options.release.set(8)
  }
}
See http://developer-blog.cloudbees.com/2014/12/beware-siren-target-call.html and http://www.draconianoverlord.com/2014/04/01/jdk-compatibility.html
m
@Vampire This does not work, I get:
> The new Java toolchain feature cannot be used at the project level in combination with source and/or target compatibility
@Thomas Broyer, thanks, the second link does not work
Also, @Thomas Broyer, the snippet you added compiles the bytecode to Java 8. I want the bytecode of Java 11 (55), but just make sure no language feature was used
v
With which version did you try? I tried with 8.1 before I sent it and it worked fine.