MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
517 stars 445 forks source link

SideStripper crashes with recent Forge versions #611

Closed mezz closed 2 years ago

mezz commented 5 years ago

This happens reliably in JEI when I set the Forge version to the latest (28.0.45) https://github.com/mezz/JustEnoughItems/blob/1.14/gradle.properties and then refresh the project.

Crash log: https://gist.github.com/mezz/7cffd959f2c8b559f622fa4b8eddf72f

JDLogic commented 5 years ago

It crashes because there are two different versions of ASM on the class path. The one causing the problem is a partial copy of ASM5 that is included in a library called json-smart. This library appears to be a transitive dependency of the git changelog plugin JEI uses.

Barteks2x commented 5 years ago

Also you can use older version of FG3, you just need to explicitly specify which one instead of 3.+

LexManos commented 5 years ago

Barteks that is not a solution if you try and run a forge version that needs side stripper on a fg that doesnt have it you'll get patch errors. We need to figure out why a transitive dependency is DOWNGRADING ASM.That sounds like a retarded gradle thing tondo.

Barteks2x commented 5 years ago

Gradle doesn't really try to resolve such dependency conflicts. I think I was wrong here. It appears to be using the right asm version on my system even with JEI project It should be possible to force specific version of asm manually, but this will break if FG ever updates ASM:

buildscript {
    // ...
    configurations.classpath.resolutionStrategy {
        force("org.ow2.asm:asm-commons:6.2.1")
    }
    // ...
}
JDLogic commented 5 years ago

Yeah, trying to force the newer asm version isn't going to work in this case as gradle already thinks its using the newer version FG depends on. Either because it doesn't know this library shades an older version, or it just doesn't care. And, it just so happens that the class loader finds the shaded older version first.

There is potential good news though. The lasted version of json-smart no longer shades asm 5, so forcing that version of the library resolves the conflict (tested and works). Granted it's not an ideal solution.

Gradle line: force("net.minidev:json-smart:2.3")

LexManos commented 5 years ago

We need to pull anything that fg has that uses asm out into external jars. If someone wants to do that I can make the repo and have you pr. But until I'm back in town its staying as is unless someone else addresses it.

SizableShrimp commented 2 years ago

Don't think this is still an issue.

mezz commented 2 years ago

I worked around this by putting the changelog plugin I use in its own separate subproject. It has all kinds of dependency incompatibilities with other gradle tooling.