Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ktor): bump to 3.0.0 #78

Merged
merged 2 commits into from
Oct 29, 2024
Merged

fix(ktor): bump to 3.0.0 #78

merged 2 commits into from
Oct 29, 2024

Conversation

monosoul
Copy link
Contributor

@monosoul monosoul commented Oct 14, 2024

Using current version of cohort with Ktor 3.0.0 causes the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: io/ktor/server/routing/RoutingKt
	at com.sksamuel.cohort.PluginKt$Cohort$2.invoke(plugin.kt:14)
	at com.sksamuel.cohort.PluginKt$Cohort$2.invoke(plugin.kt:11)
	at io.ktor.server.application.CreatePluginUtilsKt.setupPlugin(CreatePluginUtils.kt:276)
	at io.ktor.server.application.CreatePluginUtilsKt.createPluginInstance(CreatePluginUtils.kt:245)
	at io.ktor.server.application.CreatePluginUtilsKt.access$createPluginInstance(CreatePluginUtils.kt:1)
	at io.ktor.server.application.ApplicationPluginImpl.install(CreatePluginUtils.kt:83)
	at io.ktor.server.application.ApplicationPluginImpl.install(CreatePluginUtils.kt:71)
	at io.ktor.server.application.ApplicationPluginKt.install(ApplicationPlugin.kt:100)

since routing method is now located in RoutingRoot.kt instead of Routing.kt. Compiling cohort against Ktor 3.0.0 will fix that.

I've also added foojay plugin to resolve Java toolchains automatically with Gradle.

@monosoul monosoul requested a review from sksamuel as a code owner October 14, 2024 12:20
@monosoul
Copy link
Contributor Author

As a workaround one can copy plugin.kt and endpoints.kt into their own project for now.

When copying plugin.kt make sure to NOT copy CohortConfigAttributeKey definition, instead import com.sksamuel.cohort.CohortConfigAttributeKey.

@luedi
Copy link

luedi commented Oct 25, 2024

@monosoul I tried to apply the workaround, but it didn't work for me. Maybe i'm missing something. Could you explain the workaround more detailed?

@ferberts
Copy link

Hi there, we are also pending to upgrade to Ktor 3.0 and Cohort ist hindering us since we use it in our stack. Could you please do the review & merge? :) Thanks alot!

@monosoul
Copy link
Contributor Author

@sksamuel sorry for the ping, but ping

@sksamuel sksamuel merged commit d0b499d into sksamuel:main Oct 29, 2024
1 check passed
@sksamuel
Copy link
Owner

I have released 2.6.0 which bumps ktor to 3.0.0
Thanks for the PR @monosoul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants