Kotlin-based Quarkus Extension

17 views
Skip to first unread message

Stephan Strate

unread,
Feb 22, 2023, 3:26:38 PM2/22/23
to Quarkus Development mailing list

Has anyone experience with kotlin-based extensions? Any pitfalls you are aware of?

Maybe even an example extension to look at?

Thanks in advance :)

Holly Cummins

unread,
Feb 23, 2023, 4:23:19 AM2/23/23
to stephan...@gmail.com, Quarkus Development mailing list
I have, sort of. The quarkus-pact extension isn’t written in kotlin, but the pact-jvm libraries it depends on are. 

In Quarkus 2, the kotlin language libraries are handled by the parent classloader. The parent-first-ness cascades, so I also had to declare any library which used Kotlin to parent-first, or I’d get class not found exceptions. (You can see what this looks like in https://github.com/quarkiverse/quarkus-pact/blob/quarkus-2-support/quarkus-pact-consumer/runtime/pom.xml.)

In Quarkus 3, kotlin is now no longer loaded parent-first, so the extension libraries can just be handled normally. (Sort of; in my case interactions with the JUnit framework is also forcing some parent-first-ness.) 

The quarkus-pact project is https://github.com/quarkiverse/quarkus-pact. It’s got two extensions. The consumer side, https://github.com/quarkiverse/quarkus-pact/tree/main/quarkus-pact-consumer, is probably a better example to look at because it doesn’t have the JUnit framework issues. I’ve switched main over to support Quarkus 3. To see the Quarkus 2 version, you can look at https://github.com/quarkiverse/quarkus-pact/tree/quarkus-2-support/quarkus-pact-consumer

I’d recommend not neglecting your integration tests. They don’t run by default in the current extension template, but I found some classloading-related problems only turned up in the integration tests. 

Cheers, 
Holly
--
Holly Cummins
Senior Principal Quarkus Software Engineer, Java Champion

Red Hat 


--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/60e2bace-7180-4301-acfc-71862d67ffb9n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages