@@ -6,9 +6,9 @@ WORKDIR /usr/src
66COPY . .
77# Wipe any files not called pom.xml or *.jar
88RUN find . -type f -and \! -name pom.xml -and \! -name '*.jar' -delete
9- # Drop the Maven wrapper jar: the build stage copies .mvn/wrapper in
10- # separately , and keeping it here would let a wrapper- jar change
11- # invalidate the pom-only dependency layer.
9+ # Drop the Maven wrapper jar from the `poms` stage output : the build stage copies ` .mvn/wrapper` separately.
10+ # Keeping it here is redundant , and would make the `poms` stage output change when the wrapper jar changes.
11+ # (That output is later copied into the dependency-download layer.)
1212RUN rm -f .mvn/wrapper/maven-wrapper.jar
1313# Clear up any (now) empty diretories
1414RUN find . -type d -empty -delete
@@ -23,8 +23,8 @@ RUN mkdir -p .mvn
2323COPY .mvn/wrapper .mvn/wrapper
2424
2525# First, copy in the pom.xml files (and any checked-in jars) and fetch the dependencies into a real image layer.
26- # Because this layer depends only on the pom.xml files , it stays stable until a POM changes, so dependency
27- # downloads are reused whenever the source changes but the dependencies don't.
26+ # Because this layer depends on the POMs (and the Maven wrapper scripts/config) , it stays stable until one of those
27+ # inputs changes, so dependency downloads are reused whenever the source changes but the dependencies don't.
2828COPY --from=poms /usr/src/ .
2929# I don't know why we need all three either.
3030RUN ./mvnw -e -B dependency:resolve-plugins -Dmaven.test.skip -Dmaven.repo.local=/tmp/m2_repo
0 commit comments