Maven local repo in a common global directory for multiple parallel execution

I have a machine in which multiple parallel maven execution happen. Each execution executes the below command in a separate workspace directory

mvn -f main/pom.xml clean package -DskipTests -T 6

Can someone let me know should I use a separate maven local repo path (-Dmaven.repo.local=$MAVEN_REPO) for each execution or I can use a common .m2 directory for all parallel runs?

  • Maven Version 3.5
  • Java 8

Answer

This has been discsussed in maven user mailing list also. Summary of the discussion

Hello,

It is the other way around, there might be situations where one job
relies on the installed artifacts from the other, in this case you
would need a shared Repo. It is however bad style. In all other cases
you can use a executor- or even workspace-local local repository if
you have enough space.

The advantage of avoiding concurrent access is that you get less
influences from one job to the other (especially if you work with
snapshots or multiple different upstream artifacts with same version
in different Repos) and that there is no concurrent downloads (which
in itself sometimes leads to checksum errors).

Gruss Bernd

Attribution
Source : Link , Question Author : tuk , Answer Author : tuk

Leave a Comment