Gradle v3.5 Spring Boot v2.0.0.M1
I'm encountering an error when trying to run an executable jar using the auto-generated startup script insidebuild/bootScripts
:
/path/to/project $ ./build/bootScripts/myapp
Error: Unable to access jarfile /path/to/project/build/lib/myapp-boot.jar
The script is looking for the jar inside build/lib
:
// build/bootScripts/myapp
...
JARPATH=$APP_HOME/lib/myapp-boot.jar
...
By default, Gradle puts the jar inside build/libs
, not build/lib
. I can get around this by forcing Gradle to put the jar in build/lib
:
// build.gradle
...
tasks.withType(Jar) {
destinationDir = file("$rootDir/build/lib")
}
...
However, that doesn't seem like the right thing to do, and I haven't been able to figure out how to configure Spring Boot to tell the startup script to look for the jar inside the build/libs
directory.
Am I missing something? Is this a compatibility issue between these versions of Gradle and Spring Boot?
Comment From: wilkinsona
I think you are misusing the script. bootScripts
is an intermediate location that's used during the build. The script's final location is a bin
directory inside a .zip
or .tar.gz
archive that also contains your application in the lib
directory. This is all part of a distribution named boot
that the plugin automatically creates when you apply the application plugin.
Comment From: UnsungHero97
@wilkinsona thank you!
Comment From: WilsonVelandiaNivelics
Yo lo resolvi cambiando el comando de ejecución: java -jar build/libs/consuming-rest-0.0.1-SNAPSHOT.jar