<https://stackoverflow.com/questions/65830632/cant...
# multiplatform
m
https://stackoverflow.com/questions/65830632/cant-access-commonmain-multiplatform-classes-from-a-jvm-only-module/ - put a bounty on that question 😉. seems that the config works for @kpgalligan but I've tried multiple times on different IDEs and different machines, my friends also tried and it consistently fails for us. Maybe I should just post to the issue tracker, but wanted to gain some insight before I do.
y
It didn’t work for me as well. Probably related to this bug: https://youtrack.jetbrains.com/issue/KT-43934.
👍 2
k
Weird. If I get some spare time later I'll take another look. May have had a false positive or something?
n
@Michal Klimczak are you running the tests from the cli? I had the same issue: jvm module (ktor backend) having a dependency on a KMP module. Running from the ide ▶️ was causing
NoClassDefFoundError
at runtime,
./gradlew backend:run
worked on my end. I’m not sure what’s happening in the background, but my guess is that maybe the module isn’t included in the executable as the IDE can’t resolve it 🤷 (though I don’t have much knowledge around this stuff)
m
@Yev Kanivets thank you so much for confirming. @nrobi I think i tried
gradle test
or
gradle check
but I will try that again tomorrow. And in your case IDE didn't resolve the classes as well (I mean inside IDE, not when running tests)
n
@Michal Klimczak yes, same issue which @Yev Kanivets mentioned
👍 1
j
I have had the issue for a long time, I worked around by publishing the common library to my local maven and just include it from there. The build was working fine (also from intellij) but the lack of highlighting and code completion is a real bummer.
m
Good news is that the ticket that @Yev Kanivets posted has just been taken by someone in JB today
j
Maybe I am misunderstanding the problem, but for me it just works fine. I cloned your repository, imported the project in IntelliJ IDEA 2020.3. I then changed line 13 in SomeJvmTest to read
val jvmClass = SomeMultiPlatformClass()
, and it compiled and executed without a problem. I'm on Windows 10 an IntelliJ IDEA 2020.3.1 (Ultimate Edition). I tried using both an Oracle 1.8 JVM and OpenJDK 11, both worked fine.
y
Maybe on Windows it’s different 🤔
j
Yeah, could very well be. (And for the record, the test also runs fine without changing anything)
j
@Joris PZ it is not about running the code, it is about broken highlighting.
m
my friend tried on windows and it failed for him just like for me, so there must be something else, I think
it's about both @Joost Klitsie. the tests are not run when started from AS as well. but it seems to go together. if the highlighting is wrong, the tests also don't run
j
Ah yeah perhaps i should start writing tests 😅
j
If you want I can open up my IDE using CodeWithMe so you can play around with it @Michal Klimczak?
m
tbh I wouldn't know what to look for. I tried 3 IDEs, two different macs (m1 and intel), fresh installation etc. I honestly have no idea what the variable might be between the different configs that were tried by different people
k
I'm on mac and it also worked fine. Didn't get the chance to look again last night, though