build.gradle
task pathingJar(type Jar){ dependsOn confogirations.runtime appendix = "pathing" doFirst { manifest { attributes "Class-Path": configurations.compile.files.collect { it.toURI().toURL().toString().replaceFirst("file:/", '/') }.join(" ") } } } bootRun { dependsOn pathingJar doFirst { classpath = files(sourceSets.main.output.files, pathingJar.archivePath) } }
(参考)
https://stackoverflow.com/questions/5434482/how-can-i-create-a-pathing-jar-in-gradle
https://stackoverflow.com/questions/39756475/execution-of-gradle-bootrun-fails