升级到Gradle 2.0之后:在根项目上找不到属性'Compile' [英] After upgrading to Gradle 2.0: Could not find property 'Compile' on root project

查看:93
本文介绍了升级到Gradle 2.0之后:在根项目上找不到属性'Compile'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为避免构建我的Java源代码时出现有关特殊字符的警告,我将这行放在我的 gradle.build 中,它在升级到Gradle 2.0之前可以正常工作:

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

升级后,会失败,并显示以下错误:

 无法在根项目上找到属性'Compile'

我该如何解决这个问题?

解决方案

将行更改为

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

解决了这个问题。 / p>

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?

解决方案

Changing the line to

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

fixed the issue.

这篇关于升级到Gradle 2.0之后:在根项目上找不到属性'Compile'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆