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

Update Kotlin to version 2.1.0 #45470

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andreas-eberle
Copy link
Contributor

@andreas-eberle andreas-eberle commented Jan 9, 2025

Update Kotlin to version 2.1.0, Kotlinx Serialization to 1.8.0 and Kotlin Coroutines to 1.10.0

Since the Kotlin update was removed again from PR #45228, I'm opening this PR to add it separately. This is an updated version of the original PR #44809.

@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle labels Jan 9, 2025

This comment has been minimized.

Copy link

github-actions bot commented Jan 9, 2025

🎊 PR Preview f040b40 has been successfully built and deployed to https://quarkus-pr-main-45470-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

This comment has been minimized.

@andreas-eberle andreas-eberle force-pushed the feature/kotlin-2.1.0 branch 2 times, most recently from 1a6607a to 16568be Compare January 10, 2025 12:28
@andreas-eberle
Copy link
Contributor Author

I see the quickstarts compilation failed. I had a look at a problematic project and noticed that it has Kotlin version 1.7.20 set in its pom: https://github.com/quarkusio/quarkus-quickstarts/blob/main/hibernate-orm-panache-kotlin-quickstart/pom.xml

Why is there a specific version set? Should it use the version comping from the platform bom? Can I update that quickstart to use Kotlin 2.1?

@andreas-eberle
Copy link
Contributor Author

There is also a failure in the Gradle tests. I'm not sure if I understand this test correctly, but it looks like it might use old Quarkus libraries compiled without the changes in this PR. Is this possible? Or am I misunderstanding this?

The shows:

2025-01-10T13:07:05.9811852Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/descriptors.jvm.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9813996Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/descriptors.runtime.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9815954Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/deserialization.common.jvm.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9817916Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/deserialization.common.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9820265Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/deserialization.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9822371Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/kotlin-reflection.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9824426Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/2.1.0/dc3753b59b67d79b7d2f546d51e22a0ec1f082d8/kotlin-reflect-2.1.0.jar!/META-INF/metadata.jvm.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9826350Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.1.0/85f8b81009cda5890e54ba67d64b5e599c645020/kotlin-stdlib-2.1.0.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9828354Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.1.0/85f8b81009cda5890e54ba67d64b5e599c645020/kotlin-stdlib-2.1.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9830202Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.1.0/85f8b81009cda5890e54ba67d64b5e599c645020/kotlin-stdlib-2.1.0.jar!/META-INF/kotlin-stdlib.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9832342Z e: file:///home/runner/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.10.0/37966d769934a42566dec1ca2e1da6e5565c4e06/kotlinx-coroutines-core-jvm-1.10.0.jar!/META-INF/kotlinx-coroutines-core.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9834437Z e: file:///home/runner/.m2/repository/io/quarkus/quarkus-rest-kotlin/999-SNAPSHOT/quarkus-rest-kotlin-999-SNAPSHOT.jar!/META-INF/quarkus-rest-kotlin.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9836159Z e: file:///home/runner/.m2/repository/io/quarkus/quarkus-vertx-kotlin/999-SNAPSHOT/quarkus-vertx-kotlin-999-SNAPSHOT.jar!/META-INF/quarkus-vertx-kotlin.kotlin_moduleModule was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
2025-01-10T13:07:05.9836177Z 

@gsmet
Copy link
Member

gsmet commented Jan 10, 2025

Which specific Gradle test is failing?

@andreas-eberle
Copy link
Contributor Author

It's ConditionalDependenciesKotlinTest

@gsmet
Copy link
Member

gsmet commented Jan 10, 2025

You lost some of the additional changes I made in the operation. I added a commit restoring them.

@gsmet
Copy link
Member

gsmet commented Jan 10, 2025

That being said, I'm unsure how it will fly with Gradle as I ended up having issues with Gradle compatibility itself.

This comment has been minimized.

This comment has been minimized.

@andreas-eberle
Copy link
Contributor Author

I've created quarkusio/quarkus-quickstarts#1489 to update the Quickstart to fix that build error. Unfortunately, I don't understand the other compilation errors. Are they just flaky tests or is there something I need to fix? I'm a bit confused...

@gsmet
Copy link
Member

gsmet commented Jan 13, 2025

Yeah so the remaining error is the one for which I was thinking we would need a Gradle upgrade to be compatible but I'm not entirely sure:

java.lang.NoSuchMethodError: 'org.gradle.internal.buildoption.BuildOption$Value org.gradle.api.internal.StartParameterInternal.getIsolatedProjects()'	
	at org.jetbrains.kotlin.gradle.plugin.internal.ProjectIsolationStartParameterAccessorG76$isProjectIsolationEnabled$2.invoke(ProjectIsolationStartParameterAccessorG76.kt:16)	
	at org.jetbrains.kotlin.gradle.plugin.internal.ProjectIsolationStartParameterAccessorG76$isProjectIsolationEnabled$2.invoke(ProjectIsolationStartParameterAccessorG76.kt:15)	
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)	
	at org.jetbrains.kotlin.gradle.plugin.internal.ProjectIsolationStartParameterAccessorG76.isProjectIsolationEnabled(ProjectIsolationStartParameterAccessorG76.kt:15)	
	at org.jetbrains.kotlin.gradle.plugin.internal.ProjectIsolationStartParameterAccessorKt.isProjectIsolationEnabled(ProjectIsolationStartParameterAccessor.kt:45)	
	at org.jetbrains.kotlin.gradle.plugin.statistics.BuildFusService$Companion.registerIfAbsentImpl(BuildFusService.kt:94)	
	at org.jetbrains.kotlin.gradle.plugin.statistics.BuildFusService$Companion.registerIfAbsent(BuildFusService.kt:80)	
	at org.jetbrains.kotlin.gradle.plugin.DefaultKotlinBasePlugin.apply(KotlinPluginWrapper.kt:75)	
	at org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper.apply(KotlinPluginWrapper.kt:197)	
	at org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper.apply(PluginWrappers.kt:74)	
	at org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper.apply(PluginWrappers.kt:68)	
	at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:54)

I think you will need to have a look at what this method is and why it can't find it.

@andreas-eberle
Copy link
Contributor Author

@andreas-eberle
Copy link
Contributor Author

@gsmet : How did you find this exception? I tried to look in the raw logs of the failed builds, but couldn't find it.

@gsmet
Copy link
Member

gsmet commented Jan 13, 2025

There is a link to a Gradle build scan. I just searched for the module name and loaded the build scan.

@andreas-eberle
Copy link
Contributor Author

andreas-eberle commented Jan 13, 2025

So from what I found, it seems Gradle moved/renamed a class (remvoing BuildOption in favour of Option), which the kotlin-gradle plugin depends on. In https://youtrack.jetbrains.com/issue/KTIJ-31860/Sync-failure-when-using-Kotlin-2.1.20-dev-1129 it was suggested to manually set the Gradle Plugin Variant to gradle85. I tried to acomplish this by setting it in the Quarkus Gradle Plugin Code but couldn't get it to work.

To reproduce this issue, the simplest way is to switch into the directory devtools/gradle in the Quarkus main project and then run ./gradlew :gradle-application-plugin:test --tests "io.quarkus.gradle.QuarkusPluginTest.shouldNotFailOnProjectDependenciesWithoutMain"

Maybe a gradle expert has an idea?

@gsmet
Copy link
Member

gsmet commented Jan 14, 2025

I think we will just have to wait for a new version of Gradle compatible with Kotlin 2.1.0.

@gastaldi
Copy link
Contributor

Probably related to gradle/gradle#31549

@gastaldi gastaldi added the triage/on-ice Frozen until external concerns are resolved label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle area/kotlin triage/flaky-test triage/on-ice Frozen until external concerns are resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants