2016-06-22 9 views
1

私はグラブル​​タスクを実行しているときにアプリケーションにコマンドライン引数を渡そうとしているgrails 3アプリケーションを持っています。grails run-appからgraleへのコマンドライン引数の受け渡し

ランタイム操作のために私の設定ファイルの引数を読みたいと思います。

3:11:20 PM: Executing external task 'bootRun -Dcolor=red -Dfruit=apple'... 

FAILURE: Build failed with an exception. 

* Where: 
Build file 'C:\docs\projects\jet\build.gradle' line: 85 

* What went wrong: 
A problem occurred evaluating root project 'jet'. 
> Could not find method run() for arguments [[email protected]] on root project 'jet'. 

* 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: 8.892 secs 
Could not find method run() for arguments [[email protected]] on root project 'jet'. 
3:11:32 PM: External task execution finished 'bootRun -Dcolor=red -Dfruit=apple'. 

:YMLの構成ガイドhere用のGrailsのドキュメントごととして、私は、私はその設定を追加し、自分のタスクを実行すると、私は次のエラーを取得する

run { 
    systemProperties = System.properties 
} 

私のbuild.gradleファイルに以下を追加しようとしました私がここに紛失しているものがあるか、これを行う良い方法があるかどうか、私に知らせてください。

答えて

2

だから私は問題が何かを知る。

Grails 3.0では、runの代わりに​​がターゲットとして使用されます。以下のコードを変更すると、問題が解決しました。

bootRun { 
    systemProperties = System.properties 
} 

これは皆に役立ちます。

+0

同様にApplication.classにargsも渡すことはできますか? –

関連する問題