I am adding a kotlin multiplatform module to our Java-Spring monolith. It compiles just fine, I can use code from the commonMain source root.
However: IntelliJ Idea doesn't like this stuff at all. I've attached the build file for the shared module. I've added the module in the main module with
I've also tried to export the kotlin-mpp libraries by using the "api"-configuration instead of "implementation" in the shared module.
The monolith is Java only.
The error message in the IDE is:
When I add the kotlin plugin and add the same code (converted to kotlin of course) to a kotlin file, it works out just fine.
audax
07/16/2024, 10:48 AM
I only get the error in a java file, and only in the IDE. The IDE is set to use gradle for building the project and the test is green.
c
CLOVIS
07/16/2024, 12:27 PM
If you want downstream modules to access the dependencies, they should be declared with
api
.
If this exception happened in real code, I would point to classloader magic, maybe you have a framework that does weird things with it?
However, if it only happens in the IDE, there's a chance reindexing everything will solve it
a
audax
07/16/2024, 12:40 PM
I've switched back to
api
and reindexing, even removing
.idea
didn't help. 😞
The error is just in IntelliJ Idea, not when I run the test.
c
CLOVIS
07/16/2024, 12:41 PM
If you can share the project or create a reproducer, create an issue
a
audax
07/16/2024, 12:48 PM
I guess I'll have to build a minimal example and hope that I can reproduce the issue.