2015-11-18 63 views
3

我正在嘗試編譯使用最新版本gradle的現有代碼庫。構建失敗歸因於模塊以下行build.gradle文件:Gradle:沒有這類財產的類?

project.setProperty("doNow", true) 

與此錯誤:

No such property: doNow for class: org.gradle.api.internal.project.DefaultProject_Decorated 

我需要引起錯誤的行前的build.gradle中聲明該屬性?

從gradle這個文檔的setProperty

Sets a property of this project. This method searches for a property with the given name in the following locations, and sets the property on the first location where it finds the property.

回答

4

嘗試:project.ext.doNow = 'lol'

+0

這是什麼呢? – java123999

+1

它創建可以稍後設置的屬性。 – Opal

+1

Gradle文檔:https://docs.gradle.org/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html – cjstehno

相關問題