diff --git a/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GenerateJsonSchemaJavaTask.groovy b/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GenerateJsonSchemaJavaTask.groovy index e7f0f937e..9b2f4a352 100644 --- a/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GenerateJsonSchemaJavaTask.groovy +++ b/jsonschema2pojo-gradle-plugin/src/main/groovy/org/jsonschema2pojo/gradle/GenerateJsonSchemaJavaTask.groovy @@ -85,7 +85,7 @@ class GenerateJsonSchemaJavaTask extends DefaultTask { void setTargetVersion(JsonSchemaExtension configuration) { if (!configuration.targetVersion) { def compileJavaTask = project.getTasksByName("compileJava", false).first() - configuration.targetVersion = compileJavaTask.getProperties().get("sourceCompatibility") + configuration.targetVersion = compileJavaTask.sourceCompatibility logger.info 'Using Gradle sourceCompatibility as targetVersion for jsonschema2pojo: ' + configuration.targetVersion } }