Closed forpleuvoir closed 6 months ago
@thedarkcolour bump please I am also having this issue. It seems to work fine with the neoforge version on Architectury, but regular Minecraft forge causes this error.
The specific module and package seem to change too, (race condition on which one gets displayed in the error message maybe?) For example I just got this one: Modules thedarkcolour.kotlinforforge and kotlin.stdlib export package kotlin.text to module net.minecraftforge.javafmlmod
A while ago I tried to investigate this issue and found that something weird was going on with classloading. The main classloader is set up correctly, but when a method from a library was called, it would use a different classloader all of a sudden and try to load Kotlin libs in that classloader which was not set up correctly. I'll look into it again later this week.
I found a workaround until you get it fixed. If I add this to the top of the forge dependencies block, it seems to work
compileOnly(kotlin("stdlib"))
A while ago I tried to investigate this issue and found that something weird was going on with classloading. The main classloader is set up correctly, but when a method from a library was called, it would use a different classloader all of a sudden and try to load Kotlin libs in that classloader which was not set up correctly. I'll look into it again later this week.
If I forcibly make the stdlib compileOnly, it seems to fix it so that it uses the correct classloader
How can you do this in a Groovy buildscript?
compileOnly(kotlin("stdlib"))
translates to compileOnly 'org.jetbrains.kotlin:kotlin-stdlib:<kotlin version>'
You may need to add a version, unsure about that
Edit: the kotlin DSL kotlin()
function defaults to whatever your kotlin Gradle plugin version is, in my case 1.9.20
I just added that dependency to my dependencies block in the forge subproject and it more or less fixed it. I did run into a strange issue where forge sometimes can't find my mod object, it might be a race condition because sometimes it works sometimes it doesn't. It probably only happens in a dev environment though
I just added that dependency to my dependencies block in the forge subproject and it more or less fixed it. I did run into a strange issue where forge sometimes can't find my mod object, it might be a race condition because sometimes it works sometimes it doesn't. It probably only happens in a dev environment though
I have tried this before, but it didn't work
I do get this sometimes on the forge project:
The following classes are missing, but are reported in the mods.toml: [...]
It doesn't happen on fabric or NeoForge, it's definitely set up correctly and I hope it doesn't happen in production
Same root cause as #86 so I'm marking as duplicate
My English is not good, so I use AI for translation. I am developing Forge and Fabric mods using Architectury Loom. I have dependent my own utility library, but when debugging on the Forge side, I cannot start the game normally within IntelliJ IDEA. However, when I package the mod as a JAR and place it in the actual game, it works fine.
This is the source code of the problematic MOD. This is the source code of the Kotlin library being referenced.