We run Jenkins pipeline on docker container. During the run, we mount host's .m2 to container's with -
When host's .m2 mounted into container's
/usr/share/.m2 maven build takes 4 times longer than usual. This is because everytime, it downloads artifacts even though those are present in host's .m2 repo.
But if mounting is changed to root's .m2 like following, maven build completes fast as it ignores artifacts which are already downloaded in host's .m2 repo -
This seems to have correct mounting.
Could you please help to understand why mounting to
/usr/share/.m2 does fresh download and
/root/.m2 works as expected by taking host's .m2 into consideration?