quarkus: Adding a reflection configuration file fails when building native using Docker

We are currently trying to update an old 0.21.2 Quarkus Project to 0.28.1. In this project we used a reflect-config.json to keep classes from being deleted. With 0.21.2 we could successfully build a native image and a docker container, but now we can’t.

We already changed to quarkus.native.additional-build-args in the application.properties file with these parameters:

quarkus.native.additional-build-args=\
-H:ResourceConfigurationFiles=resources/main/resource-config.json,\
-H:ReflectionConfigurationFiles=resources/main/reflect-config.json

quarkus.native.enable-jni=true
quarkus.native.enable-http-url-handler=true
quarkus.native.enable-https-url-handler=true
quarkus.native.enable-all-security-services=true

Trying to execute the build ends in an error that he can’t find project/resources/main/reflect-config.json.

What Quarkus tries to execute is this: docker run -v /home/bfr/git/minical-multi/minical/build/minical-0.2.0-native-image-source-jar:/project:z --user 1000:1001 --rm quay.io/quarkus/ubi-quarkus-native-image:19.2.1 -J-Dsun.nio.ch.maxUpdateArraySize=100 -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 -H:ResourceConfigurationFiles=resources/main/resource-config.json -H:ReflectionConfigurationFiles=resources/main/reflect-config.json --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar minical-0.2.0-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:-SpawnIsolates -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace minical-0.2.0-runner

In the earlier versions of quarkus just the build directory was bound to docker as a volume and all files were found correctly, but now it is only the native-image-source-jar and we can’t figure out a way to get the reflect-config.json into it, because always on build the directory is new generated and deletes the already copied file.

The reflect-config.json itself is in the .jar file and can’t also be accessed. Is there a way to do it, like change the volume path for the docker run or any other way we oversaw?

We are using gradle to build our project.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 25 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@gastaldi you mean make users write an extension?

That is certainly possible an in this case easy to do, but I really think it’s not necessary and would be a lot more user friendly to just provide config options that would work for 95% of the use cases