javamavencontinuous-integrationmaven-repository

Maven multiple local repositories for containerized CI


Our Java applications have many dependencies, and during CI a lot of time is spent on downloading the artifacts. Since many dependencies are used in almost all applications (Hadoop, Scala, Jackson, etc., various versions), they are downloaded again and again on each application CI. The CI process is containerized for obvious reasons, and the entire .m2 folder is disposed with the container when done.

An idea came up to have 2 local repositories:

  1. Read only repository, on a shared mount, containing all the shared dependencies
  2. Writable, disposable repository on the CI container for downloading exclusive artifacts

But I couldn't find any way to configure Maven in such a way. Is it possible at all?


EDIT: the question is about LOCAL repository, where all the artifacts are being downloaded into, for the build itself.

Thanks.


Solution

  • The point is: You shouldn't dispose the local repository after the build.

    You should have the local repository in a volume that is mounted into the container.