I would like to define source and target compatibility for a Java library which is built with Gradle. Therefore, I add the following block as documented for the Java plugin.
apply plugin: 'java'
// ...
compileJava {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
When I assemble the project the following error occurs:
Could not find method sourceCompatibility() for arguments [1.7] on root project