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

To avoid special character warnings when creating 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 the update, this fails with the following error:

 Could not find property 'Compile' on root project 

How can i fix this?

+49
java gradle
Jul 10 '14 at 4:54
source share
3 answers

Change string to

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

fixed problem.

+100
Jul 10 '14 at 4:54
source share

Use task.withType(JavaCompile) .

My code is:

 buildscript { repositories { jcenter() } dependencies { classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.3' } tasks.withType(JavaCompile) { options.debug = true options.debugOptions.debugLevel = "source,lines,vars" options.encoding = "UTF-8" } } 
+2
Oct 26 '15 at 7:52
source share

For Groovy projects. This will:

 tasks.withType(GroovyCompile) { options.debug = true } 
+1
Jul 30 '15 at 22:00
source share



All Articles