quarkiverse / quarkus-azure-services

Quarkus extensions for Azure services
Apache License 2.0
13 stars 17 forks source link

Question: Does azure-core prevent native image builds? #161

Closed The-Funk closed 8 months ago

The-Funk commented 9 months ago

As I've been integrating Azure libraries into Quarkus applications the one thing I keep coming back to is azure-core. The core library's use of project reactor/netty prevents me from doing native image builds. Short of writing my own compatible azure-core and replacing those MS dependencies, is there any way to enable native image builds when using Azure services?

majguo commented 9 months ago

There is an example/workaround to enable native image with azure-core libraries, see https://github.com/quarkiverse/quarkus-azure-services/blob/main/extensions/azure-app-configuration/runtime/pom.xml#L37-L55.

majguo commented 8 months ago

Closed as no further questions.

fsantagostinobietti commented 4 months ago

There is an example/workaround to enable native image with azure-core libraries, see https://github.com/quarkiverse/quarkus-azure-services/blob/main/extensions/azure-app-configuration/runtime/pom.xml#L37-L55.

Adding quarkus-resteasy-reactive dependency to pom.xml still prevents native builds.

Error logs look like this:

Error: Classes that should be initialized at run time got initialized during image building:

io.netty.buffer.UnpooledDirectByteBuf the class was requested to be initialized at run time (subtype of io.netty.buffer.AbstractReferenceCountedByteBuf). To see why io.netty.buffer.UnpooledDirectByteBuf got initialized use --trace-class-initialization=io.netty.buffer.UnpooledDirectByteBuf
...
io.netty.buffer.ByteBufAllocator the class was requested to be initialized at run time (from 'META-INF/native-image/io.netty/netty-buffer/native-image.properties' in 'file:///project/lib/io.netty.netty-buffer-4.1.94.Final.jar' with 'io.netty.buffer.ByteBufAllocator' and from feature io.quarkus.runner.Feature.beforeAnalysis with 'ByteBufAllocator.class'). To see why io.netty.buffer.ByteBufAllocator got initialized use --trace-class-initialization=io.netty.buffer.ByteBufAllocator