Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1702

[JDK 11 Alpine Linux] JAR content is not flushed completely down to drive "Error: Invalid or corrupt jarfile target/surefire/surefirebooter13749914711390838584.jar"

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      We found an error with a corrupted JAR file published by our users. They used Docker image adoptopenjdk/openjdk11:jdk-11.0.2.9-alpine and reproduced the error by the project on GitHub.

      The plugin failure only occures when:

      • using Surefire's mode of forking a new JVM (the default behavior); and
      • On Docker image based on Alpine Linux. It does not reproduce on an image based on Ubuntu.

      I checked some errors regarding Surefire on Alpine images and I found that the plugin crashed immediately.

      /app # java -jar target/surefire/surefirebooter13749914711390838584.jar
      Error: Invalid or corrupt jarfile target/surefire/surefirebooter13749914711390838584.jar
      

      then I decided to extract the file

      /app # unzip target/surefire/surefirebooter13749914711390838584.jar -d extracted
      

      the manifest file has incomplete content:

      cat extracted/META-INF/MANIFEST.MF
      Manifest-Version: 1.0
      Class-Path: ../../../root/.m2/repository/org/apache/maven/surefire/suref
       ire-booter/3.0.0-SNAPSHOT/surefire-booter-3.0.0-SNAPSHOT.jar ../../../r
       oot/.m2/repository/org/apache/maven/surefire/surefire-api/3.0.0-SNAPSHO
       T/surefire-api-3.0.0-SNAPSHOT.jar ../../../root/.m2/repository/org/apac
       he/maven/surefire/surefire-logger-api/3.0.0-SNAPSHOT/surefire-logger-ap
       i-3.0.0-SNAPSHOT.jar ../test-classes/ ../classes/ ../../../root/.m2/rep
       ository/org/junit/jupiter/junit-jupiter-
      

      If you zip the same again /app # jar cvf MyJar.jar extracted/. and start the new JAR file separately:

      /app # java -jar MyJar.jar
      Picked up JAVA_TOOL_OPTIONS:
      no main manifest attribute, in MyJar.jar
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tibordigana Tibor Digana
            tibordigana Tibor Digana
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment