Skip to content

Instantly share code, notes, and snippets.

@christherama
Created December 19, 2016 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christherama/e45b666b2a8637bf07ee0d0a5f4ad24c to your computer and use it in GitHub Desktop.
Save christherama/e45b666b2a8637bf07ee0d0a5f4ad24c to your computer and use it in GitHub Desktop.
Gradle build file including the passing of command line args to application's main method
group 'com.example'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'application'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-M3"
}
run {
mainClassName = "com.example.Main"
if(project.hasProperty('file')) {
args(file.split(',')[0])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment