2

I regularly suffer from corrupted maven-metadata-local.xml files on my Jenkins host in directory /home/jenkins/.m2/.../some-project/

E.g. extra lines added to the end of the maven-metadata-local.xml file like this:

  ...
  </versioning>
</metadata>
astUpdated>
  </versioning>
</metadata>

Do I suffer from concurrency issues? Like the one described here (created 2007, but still unresolved): https://issues.apache.org/jira/browse/MNG-2802

What could I do to mitigate the issue?

Frizz
  • 2,524
  • 6
  • 31
  • 45

2 Answers2

0

You cannot use the same local repository for two builds at the same time or you risk inconsistent data.

We "solved" the problem by using one local repository per pipeline, i.e. every Java project that we build has its own local repository.

This is of course a huge waste of space (especially because have 1800 Java projects, so 1800 local repositories), but is an easy workaround. It would be possible, though, to use a pool of local repositories. A build could lock one of them when it starts and frees it when it ends. But you probably would need to program that logic yourself.

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

One of the comments on that JIRA mentions using a Takari extension to help with the concurrency issues. I've not tested it but always wondered how well it works.

user944849
  • 14,524
  • 2
  • 61
  • 83