
[Bug] YAML Duplicate package path conflicts
Closed this issue ยท 1 comments
Description
When this mod is installed at the same time as other mod (such as TouhouLittleMaid) that contain org.yaml.snakeyaml
, the package conflict will occur, causing the game to crash.
Root Cause
Your mod bundles an unrenamed snakeyaml
library, resulting in package path conflicts with other mods that may include the same library via JarJar or other methods. The Java module system prohibits multiple modules from exporting identical packages.
Proposed Solution
1. Use JarJar
eliminating conflicts. Implementation steps:
Update your build.gradle
with JarJar configuration:
jarJar.enable()
dependencies {
jarJar(minecraftLibrary("org.yaml:snakeyaml:2.4")) {
jarJar.ranged(it, "[2.4,)")
}
}
2. Use shadow's relocate to modify the package name
shadowJar {
// Relocate snakeyaml to a unique package (e.g., your mod's namespace)
relocate "org.yaml.snakeyaml", "com.yourmod.shadow.yaml.snakeyaml"
}