-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins ver. 2.107.3
Java 1.8.0_144
Debian 8.10
When 2 maven projects (where job B depends on job A) are built simultaneously, we often encounter this error in job B, which leads to a failed build without apparent reason:
cannot access [class name] bad class file: /home/jenkins/.m2/repository/[...].jar unable to access file: corrupted zip file
This happens because job B tries to access a jar deployed by job A while it is being written.
This occurs rather frequently here, especially when an SVN commit triggers several parallel maven builds (directly or indirectly).
Jenkins is usually aware that the jobs depend on each other, but there are situations where both are running simultaneously nevertheless, e.g. when B is triggered just before A.
I think the problem could be solved by locking files in the local maven repo while they are being written, or maybe through some semaphore to synchronize access to .m2.
This is a Maven issue. You can either use mvn 4.0 (when it's out, there https://issues.apache.org/jira/browse/MNG-2802 is fixed) or there is a setting/checkbox in Jenkins which makes each job use its own .m2 directory for isolation.