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

Kotlin compilation error with spring-cloud-function 4.2.0- #1218

Closed
bnasslahsen opened this issue Dec 7, 2024 · 4 comments
Closed

Kotlin compilation error with spring-cloud-function 4.2.0- #1218

bnasslahsen opened this issue Dec 7, 2024 · 4 comments
Labels
Milestone

Comments

@bnasslahsen
Copy link

bnasslahsen commented Dec 7, 2024

Describe the bug
Kotlin compilation error with spring-cloud-function 4.2.0

Versions of the framework:

  • Spring Boot 3.4.0
  • Spring Cloud: 2024.0.0
  • Kotlin: 1.9.25
  • Java: 17

Sample
To reproduce:

  1. Generate the project from https://start.spring.io/#!type=maven-project&language=kotlin&platformVersion=3.4.0&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=demo&name=demo&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.demo&dependencies=web,cloud-function
  2. unzip and compile the project:
./mvnw compile

Current behavior
Compilation error:

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.9.25:compile (compile) on project springdoc-openapi-starter-common: Compilation failure
[ERROR] /opt/repository/org/springframework/cloud/spring-cloud-function-context/4.2.0/spring-cloud-function-context-4.2.0.jar!/META-INF/spring-cloud-function-context.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 2.1.0, expected version is 1.9.0.
[ERROR] -> [Help 1]

Expected behavior
No compilation error

Added minimal reproducer project just in case:
demo3.zip

@olegz
Copy link
Contributor

olegz commented Dec 9, 2024

We do not specify Kotlin version anywhere in s-c-function, so it is pulled transitively.
Yes I was able to reproduce the issue with your reproducer (thank you) and it appears that something has changed upstream (perhaps in boot) since if you upgrade cloud version to 2024.0.1-SNAPSHOT, everything compiles just fine.

Please let me know, so I can close this issue

@spencergibb
Copy link
Member

See #1015. In my tests, I see the kotlin-maven-plugin using a 2.1.0 plugin. There might be some times it gets 2.1.0 and other times it doesn't.

spencergibb added a commit that referenced this issue Dec 9, 2024
@olegz
Copy link
Contributor

olegz commented Dec 10, 2024

Seems like it is indeed random, so we need to be explicit about it. . .
Thank you @spencergibb for adding it - 0a43fc9

@bnasslahsen
Copy link
Author

Wonderful, thanks @olegz and @spencergibb!
Looking forward to 4.2.1—maybe it’ll arrive just in time for Christmas!

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

No branches or pull requests

3 participants