Skip to content

Instantly share code, notes, and snippets.

@guillaumegarcia13
Created November 20, 2016 14:05
Show Gist options
  • Save guillaumegarcia13/bd9e4785e8aa158bf922de0cbf9bf504 to your computer and use it in GitHub Desktop.
Save guillaumegarcia13/bd9e4785e8aa158bf922de0cbf9bf504 to your computer and use it in GitHub Desktop.
Gradle on WIndows: Error 206
task bootRun206_clean(dependsOn: clean) { }
task bootRun206_jar(dependsOn: jar) { }
task bootRun206_bootRepackage(dependsOn: bootRepackage) { }
task bootRun206_run(type: JavaExec) {
description = "Circumvent the error 206 on Windows due to long command line"
classpath = files('build/libs/<output name>.jar')
classpath += sourceSets.main.runtimeClasspath
main = "com.example.<main class>"
}
task bootRun206(dependsOn: [bootRun206_clean, bootRun206_jar, bootRun206_bootRepackage, bootRun206_run]) {
description = "Circumvent the error 206 on Windows due to long command line"
group = "application"
}
bootRun206_jar.mustRunAfter bootRun206_clean
bootRun206_bootRepackage.mustRunAfter bootRun206_jar
bootRun206_run.mustRunAfter bootRun206_bootRepackage
@guillaumegarcia13
Copy link
Author

Gradle can reach Windows length limit on command line quite easily, resulting in a

CreateProcess error=206, The filename or extension is too long.

See also: http://tuhrig.de/gradles-bootrun-and-windows-command-length-limit/ for another approach using the 'pathingJar' approach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment