Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

gradle

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?

like image 559
Matthias Braun Avatar asked Jul 10 '14 04:07

Matthias Braun


2 Answers

Changing the line to

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

fixed the issue.

like image 72
Matthias Braun Avatar answered Oct 14 '22 23:10

Matthias Braun


For Groovy based projects. It'd be:

tasks.withType(GroovyCompile) {
    options.debug = true
}
like image 36
AKS Avatar answered Oct 14 '22 22:10

AKS