2016-07-08 11 views
0

私はこれは私がextProgramはの財産であると想定されるため、これがあるgradleがプロパティファイルを印刷しないのはなぜですか?

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 

答えて

2

の誤差が出ているグルーヴィー/ Gradleの中から、単純なprint文を実行しようとしているが、私はエラーを取得

extProgram = new Properties() 
extProgram.load(new FileInputStream("src/main/resources/version.txt")) 

ext.appVersion=extProgram['version'] 

println ext.appVersion 

ていますプロジェクト。 これを代わりに試してください:

def extProgram = new Properties() 
... 

これはextProgramをローカル変数として定義しています。

+0

私はそれをプロジェクトのプロパティにしたいので、私は別のタスクで使うことができます。 –

+0

その場合、 'ext.extProgram = ...' – Henry

関連する問題