Coder
Coder

Reputation: 51

Quarkus native image build fails with unknown arguments

I am building a quarkus native executable image but it is failing because of unknown argument . I have used quarkus.native.additional-build-args variable in property file but it is not working.

I am using java 11. Can

SLF4J: Found binding in [jar:file:/home/quarkus/.m2/repository/org/jboss/slf4j/slf4j-jboss-logging/1.2.0.Final/slf4j-jboss-logging-1.2.0.Final.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/quarkus/.m2/repository/ch/qos/logback/logback-classic/1.1.1/logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.jboss.slf4j.JBossLoggerFactory]
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /usr/src/app/target/quarkus-test-1.0.0-SNAPSHOT-native-image-source-jar/quarkus-test-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /usr/src/app/target/quarkus-test-1.0.0-SNAPSHOT-native-image-source-jar/quarkus-test-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0 (Java Version 11.0.7)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /opt/graalvm/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -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-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-run-time=com.wealdtech.hawk.HawkClient com.wealdtech.hawk.HawkCredential --allow-incomplete-classpath --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar quarkus-test-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-test-1.0.0-SNAPSHOT-runner
Error: Unknown argument: quarkus-test-1.0.0-SNAPSHOT-runner
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  21.640 s
[INFO] 
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.9.0.Final:build (default) on project quarkus-test: Failed to build quarkus application: io.quarkus.builder.BuildException: 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:307)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

Do any one has any Idea?? Thank you!!!

Upvotes: 3

Views: 1647

Answers (2)

theINtoy
theINtoy

Reputation: 3698

Just in case anybody else is losing hair on this and ends up here. My build was failing in a similar way:

building quarkus jar

Error: Unknown argument: <yada, yada...>

looking at my application.properties I had some build args:

quarkus.native.additional-build-args=\
  -H:+PrintClassInitialization,\
  --report-unsupported-elements-at-runtime,\
  --allow-incomplete-classpath,\  
  --initialize-at-run-time=a.b.c.d\\,\
  a.b.c.e\\,\
  a.b.c.f

Nothing obvious there then. Looking closer though:

  --allow-incomplete-classpath,\  

Had 2 white space characters at the end of the line after the ,\ removing the white spaces fixed it. OUCH!

Upvotes: 0

MGubler
MGubler

Reputation: 419

I had the same issue, when using quarkus.native.additional-build-args in the applications.properties file. The issues I had was, that I defined multiple packages in the --initialize-at-build-time parameter, separated with a comma as: --initialize-at-build-time=javax.net.ssl,java.security

This needed to be masked as following: --initialize-at-build-time=javax.net.ssl\\,java.security

Upvotes: 6

Related Questions