We found an error with a corrupted JAR file published by our users. They used Docker image adoptopenjdk/openjdk11:jdk-22.214.171.124-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:
i-3.0.0-SNAPSHOT.jar ../test-classes/ ../classes/ ../../../root/.m2/rep
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