Skip to content

Instantly share code, notes, and snippets.

@ilyarudyak
Last active June 23, 2016 20:56
Show Gist options
  • Save ilyarudyak/4f6ada945e6b6b750492627ead926ee7 to your computer and use it in GitHub Desktop.
Save ilyarudyak/4f6ada945e6b6b750492627ead926ee7 to your computer and use it in GitHub Desktop.
run java file with command-line arguments using Gradle
./gradlew -PmainClass=liang.IdentifyHostNameIP -'Pmyargs=www.whitehouse.gov,130.254.204.34' execute --daemon
// in gradle.build
task execute(type:JavaExec) {
if(project.hasProperty('myargs')){
args(myargs.split(','))
}
main = mainClass
classpath = sourceSets.main.runtimeClasspath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment