Closed jamesward closed 2 years ago
Yeah with the JVM, it likely fallback on reading the .class
resource with ASM which is not possible on native where the javaParameters
is mandatory, so my feeling is that this issue is not specific to Spring Native but should be solved at Kotlin or Spring Boot Gradle plugin level.
At Kotlin level, maybe the multiplatform Gradle plugin should be configured in a way that allow Spring Boot plugin to detect and configure this option as it does with the JVM one.
If not possible, maybe Spring Boot Gradle plugin could configure the Kotlin multiplatform Gradle plugin to configure kotlinOptions.javaParameters = true
properly but as stated on https://kotlinlang.org/docs/multiplatform.html it is still Alpha level so it may be too early for that.
@jamesward For the time behind, I can maybe add related documentation. Could you share how you configured it manually?
Thank you. Here is my config: https://github.com/jamesward/kotlin-bars/blob/main/common/build.gradle.kts#L48-L50
@wilkinsona Based on James feedback, it seems Spring Boot Gradle plugin configure javaParameters
for Kotlin JVM plugin but not for the multiplaform one. If possible to qualify that without too much effort, could you share if that should be raised as an improvement request on Spring Boot side (which would be me preferred option given the manual config James did above)? If not, we will document it on Spring Native side.
The common
module doesn't appear to apply the Spring Boot plugin. Assuming that I've got that right, it's to be expected that javaParameters
hasn't been configured automatically in that module. It looks to me like server
is the only module with Boot's plugin applied.
That could happen for Java multi-module projects as well, that's now properly documented.
@wilkinsona I had the plugin in there and it wasn't working so I pulled it out. Let me know if you want a branch with that back in.
Given that the common
module doesn't appear to be a Spring Boot application, but instead a common shared library, I don't think it makes sense to apply Boot's plugin to it.
Usually the
id("org.springframework.boot")
Gradle plugin adds:But it doesn't in a Kotlin Multiplatform project (I think because the task is named differently than it expects).
Using a Kotlin data class in a Spring Data repo works fine on the JVM without this setting. But running via Spring Native, when trying to map the DB data, an exception is produced like:
I'm not sure if Spring Native can do anything to make this better / easier to troubleshoot but figure this might help others.