Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-mod workspaces with dependencies have duplicate Minecraft entries in the classpath #124

Closed
FiniteReality opened this issue May 2, 2024 · 8 comments

Comments

@FiniteReality
Copy link
Member

This causes https://github.com/neoforged/FancyModLoader/blob/main/loader/src/main/java/net/neoforged/fml/util/DevEnvUtils.java#L72 to throw when it detects multiple Minecraft classes on the classpath

@FiniteReality
Copy link
Member Author

A workaround is to declare Neo dependencies against the compileOnly configuration in the build.gradle for either the main, or the dependent mods

@Matyrobbrt
Copy link
Member

I would not call this a bug, more like an intended feature. Your "workaround" is how you should declare your dependencies to begin with, the dependency on NeoForge should not be leaked, as that will cause issues for the consumers of your artifact too.

@shartte
Copy link
Contributor

shartte commented May 2, 2024

Well, I still do not quite understand why Gradle is not collapsing this dependency 🤔

@FiniteReality
Copy link
Member Author

FiniteReality commented May 2, 2024

the dependency on NeoForge should not be leaked, as that will cause issues for the consumers of your artifact too.

But you need NeoForge in compileClasspath AND runtimeClasspath, but not leaked to consumers - there's no way to do this by default in gradle so you need a custom configuration. This is a huge pain compared to previous versions.

@FiniteReality
Copy link
Member Author

Well, I still do not quite understand why Gradle is not collapsing this dependency 🤔

Each project has its own generated neoforge repo, and since the artifacts are different it passes them all, is my undersatnding

@Shadows-of-Fire
Copy link

Is this issue also the cause of neoforged/NeoGradle#162?

@marchermans
Copy link
Contributor

Well, I still do not quite understand why Gradle is not collapsing this dependency 🤔

Each project has its own generated neoforge repo, and since the artifacts are different it passes them all, is my undersatnding

Gradle will do that, but the IDE won't it looks like.
Gradle resolves based on the GAV and will only pass one into the classpath of the run.
The IDE has no such idea, it just passes them in all together.

NG7 should collapse them yeah (it currently does not because it creates one IVY repo per project, but that is fixable by using the root project instead, plus some fenagling with task dependencies). But this problem always existed (different ATs, different subprojects with minecraft etc) and FML handled that always gracefully.

What changed that it does not do that now?

@FiniteReality
Copy link
Member Author

This was resolved with a change to NeoGradle: neoforged/NeoGradle#167 - as far as I understand the error for duplicate minecraft jars is now intended behaviour, and it's on tools like Gradle to properly remove the duplicates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants