0

In order to speed up our internal testing pipeline, I have decided to set up a docker image with pre-cached maven dependencies instead of them being downloaded in our pipeline each time.

We are using the mvn dependency:go-offline command during the docker process, and it is indeed downloading the local repository and being built into the image.

However, when we run our maven target from within the container when it is run I am seeing those same dependencies being re-downloaded. Is there a flag or something that I can use to ensure that maven first looks in the local repository?

Emile Victor
  • 923
  • 1
  • 12
  • 22
  • For various reasons we aren't pulling down *all* the dependencies, I'd like some cached locally and some remotely. is that compatible with the -o flag? – Emile Victor Mar 18 '19 at 16:11
  • Ok, then you cannot use the `-o` flag. If your dependencies are not SNAPSHOT, it is not too bad, because only metadata is redownloaded, not entire artifacts. – J Fabian Meier Mar 18 '19 at 16:13

1 Answers1

0

You need to build with the -o flag.

See also: https://stackoverflow.com/a/7233762/927493

This allows you build offline without contacting the repositories.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142