FROM gradle:jdk8 as gradle WORKDIR /app COPY settings.gradle build.gradle ./ COPY module-core/build.gradle ./module-core/ COPY gradle ./gradle RUN gradle build --no-daemon --info --stacktrace #make gradle download dependencies COPY . . RUN gradle :module-core:bootJar --no-daemon --info --stacktrace #should reuse the dependencies
As shown I copy the gradle configuration files without the source codes to make gradle download the dependencies, and I can make sure that gradle download a lot of dependencies through the log.
Then I copy the source codes and run the build again, I expect that gradle will use the cached depedencies , however I found it download them again.
What’s going on?