How to share single Maven local repo among multiple builds with Takari
Recently we started using Kubernetes plugin in our Jenkins for spinning up agents on demand. Every time a build starts it creates a new pod and once it the build finishes the pod is destroyed. The agents are not reusable. We use maven as a build tool and we have some jobs that download 7-8 Gb of dependecies. Sometimes the builds took 1 hour - 1 hour and a half to download the dependencies and most of the time the builds failed due to timeout. We created a volume that was mapped with the maven local repo of the agents, but maven local repository is not safe for concurrent access and we had to find something else. Luckily we found a maven plugin called Takari . Takari enables safe concurrent use of the local repository. In order to share local repo among multiple builds you have to add the followin code in your pipelines bevore running maven tasks: sh """ curl -O http://repo1.maven.org/maven2/io/takari/aether/takari-local-repository/0.10.4/takari-local-reposito