spring-guides / gs-spring-boot-docker

Spring Boot with Docker :: Learn how to create a Docker container from a Spring Boot application with Maven or Gradle

Home Page:https://spring.io/guides/gs/spring-boot-docker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails under Windows: "complete.jar: no such file or directory"

helmbold opened this issue · comments

If I run the complete example (commit 1c8ad64, using Gradle 4.7 and Docker 18.03 under Windows 10) I get the following error:

> gradle docker

> Task :docker FAILED
ADD failed: stat /var/lib/docker/tmp/docker-builder196981867/complete.jar: no such file or directory

FAILURE: Build failed with an exception.

It seems like no file complete.jar is generated. And seemingly the docker task misses a dependency.

If I change the docker task in the following way, it works:

docker {
    dependsOn bootJar
    name "${project.group}/${jar.baseName}"
    files bootJar.archivePath
    buildArgs(['JAR_FILE': "${bootJar.archiveName}"])
}

If this gets fixed, the guide should be fixed as well.

I can no longer reproduce the exact error message with .../complete.jar, but the file gs-spring-boot-docker-0.1.0.jar doesn't exist, too, without running bootJar or build previously.

> gradle clean docker

> Task :docker FAILED
ADD failed: stat /var/lib/docker/tmp/docker-builder730788425/gs-spring-boot-docker-0.1.0.jar: no such file or directory

So adding the task dependency makes sense in any case. I've created a pull request to do so.

Obsolete, I think, since we changed the guide to use jib. There was a typo fixed in da6d84a.