0
我試圖從gradle產出/ Groovy中執行簡單的print語句,但我得到的錯誤爲什麼gradle不打印屬性文件?
extProgram = new Properties()
extProgram.load(new FileInputStream("src/main/resources/version.txt"))
ext.appVersion=extProgram['version']
println ext.appVersion
這是錯誤我得到
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "extProgram" on "root project 'appController'", value: "{}".
2.0.193
[buildinfo] Not using buildInfo properties file for this build.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/Documents/codebase/app-controller/build.gradle' line: 54
* What went wrong:
A problem occurred evaluating root project 'appConroller'.
> Could not find method $() for arguments [bui[email protected]411109d] on root project 'appController'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.972 secs
我希望它是項目的屬性,所以我可以在不同的任務中使用它。 –
在這種情況下使用:'ext.extProgram = ...' – Henry