SpongePowered / SpongeForge

A Forge mod that implements SpongeAPI
http://www.spongepowered.org/
MIT License
1.14k stars 306 forks source link

Version conflict with com.typesafe:config in development environment #404

Closed JBYoshi closed 9 years ago

JBYoshi commented 9 years ago

When updating dependencies, Forge and Sponge both have dependencies on com.typesafe:config with conflicting versions. Eclipse adds both to the classpath and gives priority to the Forge-provided version, resulting in errors at runtime.

Full console log up to the point the first exception was thrown:

[11:10:26] [main/INFO] [GradleStart]: userProperties: []
[11:10:26] [main/INFO] [GradleStart]: accessToken: NotValid
[11:10:26] [main/INFO] [GradleStart]: version: MCDev
[11:10:26] [main/INFO] [GradleStart]: username: JBYoshi
[11:10:26] [main/INFO] [GradleStart]: Extra: [--tweakClass, org.spongepowered.asm.launch.MixinTweaker]
[11:10:26] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, [], --assetsDir, C:/Users/Jonathan/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken{REDACTED}, --version, MCDev, --username, JBYoshi, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, org.spongepowered.asm.launch.MixinTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[11:10:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[11:10:26] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[11:10:26] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.launch.MixinTweaker
[11:10:26] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.4.6 Source=file:/C:/Users/Jonathan/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.4.6-SNAPSHOT/6946b6fb004a2ebdaab7c5822736bd08d8cec308/mixin-0.4.6-SNAPSHOT.jar Env=CLIENT
[11:10:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[11:10:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[11:10:27] [main/INFO] [FML]: Forge Mod Loader version 11.14.3.1543 for Minecraft 1.8 loading
[11:10:27] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_60, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jdk\jre
[11:10:27] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[11:10:27] [main/INFO] [FML]: Found a command line coremod : org.spongepowered.mod.SpongeCoremod
[11:10:27] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.SpongeCoremod$TokenProvider to MixinEnvironment[PREINIT]
[11:11:01] [main/ERROR] [org.spongepowered.common.configuration.SpongeConfig]: java.lang.NoSuchMethodError: com.typesafe.config.impl.ConfigImpl.newSimpleOrigin(Ljava/lang/String;)Lcom/typesafe/config/ConfigOrigin;
    at com.typesafe.config.ConfigOriginFactory.newSimple(ConfigOriginFactory.java:42)
    at ninja.leaping.configurate.hocon.HoconConfigurationLoader.<clinit>(HoconConfigurationLoader.java:155)
    at org.spongepowered.common.configuration.SpongeConfig.<init>(SpongeConfig.java:166)
    at org.spongepowered.common.Sponge.getGlobalConfig(Sponge.java:128)
    at org.spongepowered.mod.SpongeCoremod.<init>(SpongeCoremod.java:74)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at java.lang.Class.newInstance(Class.java:442)
    at net.minecraftforge.fml.relauncher.CoreModManager.loadCoreMod(CoreModManager.java:526)
    at net.minecraftforge.fml.relauncher.CoreModManager.handleLaunch(CoreModManager.java:239)
    at net.minecraftforge.fml.relauncher.FMLLaunchHandler.setupHome(FMLLaunchHandler.java:95)
    at net.minecraftforge.fml.relauncher.FMLLaunchHandler.setupClient(FMLLaunchHandler.java:72)
    at net.minecraftforge.fml.relauncher.FMLLaunchHandler.configureForClientLaunch(FMLLaunchHandler.java:34)
    at net.minecraftforge.fml.common.launcher.FMLTweaker.injectIntoClassLoader(FMLTweaker.java:119)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:115)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    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:497)
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    at GradleStart.main(Unknown Source)
    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:497)
    at jbyoshi.devlauncher.GameLauncher.callMain(GameLauncher.java:101)
    at jbyoshi.devlauncher.GameLauncher.access$0(GameLauncher.java:68)
    at jbyoshi.devlauncher.GameLauncher$1.run(GameLauncher.java:74)
    at java.lang.Thread.run(Thread.java:745)
stephan-gh commented 9 years ago

Is your workspace up-to-date? It seems like Eclipse is providing the wrong configurate version. Make sure you've refreshed the Gradle project or regenerated it (can't remember how it works with Eclipse).

JBYoshi commented 9 years ago

Yep, Eclipse is up to date. Still getting the error.

Deamon5550 commented 9 years ago

We did a juke forward and back again with the configurate version didn't we? thats probably the cause of this. I would make sure that you've done Right Click > Gradle > Refresh All on all the projects and then try again. If that fails try removing the projects and reimporting the gradle project.

JBYoshi commented 9 years ago

@Deamon5550 That didn't solve it, unfortunately.

I found a bit more information by running gradle dependencies, which shows why the two versions are appearing (some parts omitted):

apiCompile, apiRuntime, compile, default, runtime, testCompile, and testRuntime
+--- project :SpongeCommon
|    +--- project :SpongeCommon:SpongeAPI
|    |    |    (...)
|    |    +--- ninja.leaping.configurate:configurate-hocon:3.0
|    |    |    +--- com.typesafe:config:1.3.0
(...)

forgeGradleMcDeps
| (...)
+--- com.typesafe.akka:akka-actor_2.11:2.3.3
|    +--- org.scala-lang:scala-library:2.11.1
|    \--- com.typesafe:config:1.2.1
+--- com.typesafe:config:1.2.1
| (...)
Deamon5550 commented 9 years ago

Until a better fix is found for now you can downgrade configurate locally to version 2.0 in SpongeAPI and it should work fine.

JBYoshi commented 9 years ago

@Deamon5550 Yep, that works. I'll leave this open so someone can find a better solution.

progwml6 commented 9 years ago

there is a way to tell gradle itself not to load specific versions of libraries.

https://docs.gradle.org/current/userguide/dependency_management.html#exclude-dependencies

stephan-gh commented 9 years ago

It's working fine for me in Eclipse. How did you import the project?

JBYoshi commented 9 years ago

@Minecrell I used Import -> Gradle -> Gradle Project. I'm using the Gradle plugin written by SpringSource since it's more fully featured than Buildship.

stephan-gh commented 9 years ago

Apparently the plugins seem to be both broken (they generate a broken project configuration for Sponge), although gradle eclipse works just fine for me.

JBYoshi commented 9 years ago

Seems like it's been fixed. config-1.2.1.jar now has a lower priority than config-1.3.0.jar. Not sure exactly what created the fix, though.

Closing.