Describe the bug
Upgrading to Quarkus 0.26.0 fail the build of native-image when using <additionalBuildArgs>
The generated command is:
native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true [-H:IncludeResources=.*/banner.txt] --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar app-0.8-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace app-0.8-SNAPSHOT-runner
Note the brackets around -H:IncludeResources=.*/banner.txt, the list of additional args is show with the brackets and that causes the fail.
Expected behavior
Native image working.
Actual behavior
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on OpenJDK 64-Bit GraalVM CE 19.2.1
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /home/quarkus/.sdkman/candidates/java/current/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true [-H:IncludeResources=.*/banner.txt] --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar app-0.8-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace app-0.8-SNAPSHOT-runner
Error: Unknown argument: app-0.8-SNAPSHOT-runner
......
......
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.26.0:native-image (default) on project operator: Failed to generate a native image: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:294)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:940)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.lang.Thread.run(Thread.java:748)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:283)
[ERROR] ... 12 more
To Reproduce
Steps to reproduce the behavior:
<additionalBuildArgs>-H:IncludeResources=.*/banner.txt</additionalBuildArgs>Environment (please complete the following information):
java -version: OpenJDK 64-Bit GraalVM CE 19.2.1@jorsol just wanted to thank you for reporting the issue right away. We released 0.26.1 right away thanks to that.
Thank you for a really fast bugfix. :smile:
What was the fix actually, i stil have this error with quarkus 1.9.1 and quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /Users/manueldupont/cjl-scheduler/target/cjl-api-scheduler-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Drx.unsafe-disable=true -J-Duser.language=en -J-Dfile.encoding=UTF-8 -H:ResourceConfigurationFiles=resources-config.json -H:+ReportUnsupportedElementsAtRuntime --no-server --allow-incomplete-classpath --initialize-at-run-time -H:-UseServiceLoaderFeature --enable-all-security-services -H:ConfigurationFileDirectories=config-dir -H:EnableURLProtocols=http https --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar cjl-api-scheduler-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services --no-server -H:-UseServiceLoaderFeature -H:+StackTrace cjl-api-scheduler-1.0.0-SNAPSHOT-runner
Error: Unknown argument: cjl-api-scheduler-1.0.0-SNAPSHOT-runner
Here is my config:
quarkus:
native:
additional-build-args: \
-H:ResourceConfigurationFiles=resources-config.json, \
-H:+ReportUnsupportedElementsAtRuntime, \
--no-server, \
--allow-incomplete-classpath, \
--initialize-at-run-time, \
-H:-UseServiceLoaderFeature, \
--enable-all-security-services, \
-H:ConfigurationFileDirectories=config-dir, \
-H:EnableURLProtocols=http,https
What was the fix actually, i stil have this error with quarkus 1.9.1 and quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11
@manodupont the original issue was that adding additionalBuildArgs creates an invalid command line since the arguments where added with brackets around them [-H:IncludeResources=.*/banner.txt] (printed as an array of elements).
So here the fix is that now the additional build args are added without the brackets. I don't' see it's your case and your are building with docker also (witch might or might not introduce the problem) , while the subject and the error might look similar, the root cause seems different.
Feel free to open a new issue with a small reproducer and the Quarkus team will help with a supersonic fix. :smile:
@manodupont can you open a new issue with a small reproducer? Thanks!
Most helpful comment
@jorsol just wanted to thank you for reporting the issue right away. We released 0.26.1 right away thanks to that.