I am trying to Dockerize the maven build for my multi-module project. I have a nested file structure in which all modules for my project are contained in a modules/ directory. As part of the build, I would like to cache the dependencies so the container does not need to pull the dependencies unless the POM files are updated (i.e. Java changes should not necessitate pulling the dependencies every time). I have this working currently by copying each POM into the appropriate directory in the build container using individual Docker commands for each file; however, I have roughly 10 modules, currently, and may add more in the future. I would like to avoid having to individually COPY each POM as modules are added. I see that COPY supports the wildcard syntax for the source file parameter, but simply cannot get this working. The command I currently have is:
COPY modules/*/pom.xml ./
but this does not seem to properly copy. I'm sure there is a way to COPY these files without having to specify a command for each one. What is the proper command for doing this? Thank you very much in advance for any help!