DEV Community

özkan pakdil
özkan pakdil

Posted on • Originally published at ozkanpakdil.github.io on

Ktor build with graalvm

I wanted to test ktor.io with graalvm build, main problem is all code I found using gradle and my project is using mvn here is the code. like other modules I needed to create reflect config json, otherwise ktor serialize is not working properly with graal and when I send a request to “/hello” endpoint I got empty response. I tried to write myself but did not work and at the end I used command below

java -agentlib:native-image-agent=config-output-dir=./graalcnf/ -jar target/ktor-demo-1.0.1-SNAPSHOT-jar-with-dependencies.jar

Enter fullscreen mode Exit fullscreen mode

when I ran this command in ktor-demo folder it created graalcnf folder and wrote every required files there. After that we need to give those to graal native build with the config below

Args = --enable-http \
-H:IncludeResources=.*\\.properties \
  -H:ConfigurationFileDirectories=${project.basedir}/graalcnf/ 

Enter fullscreen mode Exit fullscreen mode

Check here to see full configuration. ktor and other imagesKtor response with graal vm is 35 and quarkus is 23. can see full respot here.

Top comments (0)