Shadowfacts' Forgelin

Shadowfacts' Forgelin

108M Downloads

Kotlin classes don't compile until after the Java ones do causing Java compilation to fail

5HT2 opened this issue ยท 5 comments

commented

I have this mod here kami-blue, and when I try building with Forgelin my Kotlin classes aren't found with this error

/home/dominika/projects/kamiblue/build/sources/main/java/me/zeroeightsix/kami/KamiMod.java:22: error: cannot find symbol
import me.zeroeightsix.kami.module.modules.client.CommandConfig;
                                                 ^
  symbol:   class CommandConfig
  location: package me.zeroeightsix.kami.module.modules.client

Edit: check my kotlin branch to see the changes

commented

Well, you removed kotlin from the compile process altogether: kami-blue/client@8f8d02f

You still need to compile Kotlin, Forgelin will only give you the runtime dependencies for Kotlin. That means: Re-add the buildscript changes and the apply plugin: 'kotlin'

commented

@bziemons I removed Intellij's Kotlin plugin and replaced it with Forgelin in the next commit.

I wasn't aware I had to keep those, that should probably be mentioned in the readme.

I'll update this issue with the result in a minute.

commented

Well it compiles now, but I get the same error I had before I added Forgelin (in a normal env)

Log
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: kotlin/TypeCastException
        at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)
        at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:599)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)

You can see the branch here. Note, it works fine in a dev env. My kotlin library isn't being included in the full shadowjar. You can view the full build.gradle here

commented

I got it to work by adding the Forgemod jar to my mods folder. I'd rather not make users download 2 jars, I'm trying to work out how to include it now.

commented

I got it working, though it did double my jar size and now it's too big for discord. Oh well. You can see how I did it here