Skip to content

Instantly share code, notes, and snippets.

@h1romas4
Last active July 29, 2018 09:29
Show Gist options
  • Save h1romas4/bd0495aa6cf0270d5a9403db623fcde5 to your computer and use it in GitHub Desktop.
Save h1romas4/bd0495aa6cf0270d5a9403db623fcde5 to your computer and use it in GitHub Desktop.
Gradle の Application プラグインで ./gradlew run 実行時に引数を指定する(Gradle 4.9 未満)
apply plugin: 'groovy'
apply plugin: 'application'
mainClassName = 'Hego'
/**
* 起動オプション
*
* Gradle 4.9 なら次で OK
* ./gradlew run --args 'foo --bar'
*
* Gradle 4.9 未満はこの設定を追加して次のように実行
* ./gradlew run -PappArgs"['hego1', 'hego2', 'hego3']"
**/
run {
if(project.hasProperty('appArgs')) {
args Eval.me(appArgs)
}
}
dependencies {
compile localGroovy()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment