Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51628

Simultaneous Maven builds fail with bad class file: corrupted zip file while getting local dependency jar

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: maven-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.107.3
      Java 1.8.0_144
      Debian 8.10
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          jdanekrh Jiri Danek added a comment -

          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.

          Show
          jdanekrh Jiri Danek added a comment - 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.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            hok hok
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: