gradle build fails when Docker is not available
irinatudose opened this issue · comments
When Docker is not available ./gradlew clean build
fails because of the processTestAot
failed task.
./gradlew clean build
...
> Task :processTestAot FAILED
...
Exception in thread "main" org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=mysql:5.7, imagePullPolicy=DefaultPullPolicy(), imageNameSubstitutor=org.testcontainers.utility.ImageNameSubstitutor$LogWrappedImageNameSubstitutor@62163b39)
...
Caused by: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
My current workaround is to skip the processTestAot
task, and build with ./gradlew clean build -x processTestAot
which works.
The maven build, however, doesn't have this issue. It works with or without Docker.
Any idea of what the problem is?
Maven doesn't run the AOT processor by default, so that explains why it doesn't fail if you do the simplest possible thing. I'll ask the AOT team if there's anything we can do to fix the Gradle build, other than your workaround.
See spring-projects/spring-boot#37097 for more detail and tracking progress. Also spring-projects/spring-boot#36273.
Does Gradle need to run the AOT processor by default? Would it be reasonable to fix this by making AOT opt-in rather than broken by default, matching Maven?
You’re asking in the wrong place. Petclinic is just a user of the build tools. Follow links to issues in my last comment.
Adding the new @DisabledInAotMode
annotation to the tests where Docker Compose support is enabled would fix this I believe.
It works for me now, so I think someone already did that.
Hmmm. Still seems broken to me...
But applying @wilkinsona's recommendation seems to work in #1411.