After upgrading to Gradle 2.0: Could not find property 'Compile' on root project

gradle, java

Solution

Changing the line to

tasks.withType(JavaCompile) { options.encoding = "UTF-8" }

fixed the issue.

Problem

To avoid warnings regarding special characters when building my Java source code, I put this line in my `gradle.build` which worked fine before upgrading to Gradle 2.0: ``` tasks.withType(Compile) { options.encoding = "UTF-8" } ``` After upgrading, this fails with the following error: ``` Could not find property 'Compile' on root project ``` How can I fix that?

Original source