After upgrading my spring-boot application from spring-boot version 2.3.9 to 2.5.12 We have started getting below exception. Not sure if there is change related to docker in spring boot version 2.5.12
With previous version it was working fine but after changing gradle to 6.8 and spring-boot version this issue started ... any workaround to fix this issue? This is the command that causes error in Dockerfile
ENV APP_HOME=/app/z-api/
COPY --from=build "${APP_HOME}build/libs/z-api-*.jar" app.jar
COPY --from=build "${APP_HOME}build/libs/z-api-*.jar" app.jar When using COPY with more than one source file, the destination must be a directory and end with a /
CodePudding user response:
There are now two jars in build/libs
that match z-api-*.jar
. This is due to Spring Boot 2.5 no longer disabling the jar
task by default. From the release notes:
The Spring Boot Gradle Plugin no longer automatically disables the standard Gradle jar and war tasks. Instead we now apply a classifier to those tasks.
If you prefer to disable those tasks, the reference documentation includes updated examples.
You could update your COPY
command so that it doesn’t match the -plain.jar
that’s now produced by the jar
task. Alternatively, you could disable the jar
task:
jar {
enabled = false
}