quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.36k stars 2.56k forks source link

Native Build Fails, when Reusing Existing Executable with Compression Enabled #41373

Open gcw-it opened 1 week ago

gcw-it commented 1 week ago

Describe the bug

Building a native executable with <quarkus.native.reuse-existing>true</quarkus.native.reuse-existing> set, and compression enabled, leads to a failing build, when the artifact already exists.

Expected behavior

The plugin skips the compression step for the already compressed executable, and the build is finished without error.

Actual behavior

The build fails with: Build step io.quarkus.deployment.pkg.steps.UpxCompressionBuildStep#compress threw an exception: java.lang.IllegalStateException: Unable to compress the native executable

How to Reproduce?

  1. quarkus create
  2. add the following properties to the native profile in pom.xml.
    <quarkus.native.container-build>true</quarkus.native.container-build>
    <quarkus.native.reuse-existing>true</quarkus.native.reuse-existing>
    <quarkus.native.compression.level>1</quarkus.native.compression.level>
  3. mvn package -DskipTests -Dnative
  4. When running the build a 2nd time (mvn package -DskipTests -Dnative) the build fails, because the plugin tries to recompress the already compressed executable.

Output of uname -a or ver

Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64

Output of java -version

java 22.0.1 2024-04-16

Mandrel or GraalVM version (if different from Java)

quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21

Quarkus version or git rev

3.11.3

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)

Additional information

No response

quarkus-bot[bot] commented 1 week ago

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)