MinecraftForge / ForgeGradle

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

Task Reobf Jar failed on ForgeGradle 6.+ when disconnected #947

Closed SAOS-IT closed 1 month ago

SAOS-IT commented 1 month ago

When I execute Reobf Jar task with --offline on a fresh forge 1.16.5 36.2.42 mdk, everything works fine. But it's failed the moment I disconnected my WIFI:

Configure project : Java: 17.0.11, JVM: 17.0.11+9 (Eclipse Adoptium), Arch: amd64 org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mavenDownloader_net.minecraftforge_ForgeAutoRenamingTool_1.+_all_1'. <11 internal lines> at net.minecraftforge.gradle.common.util.MavenArtifactDownloader._gradle(MavenArtifactDownloader.java:324) at net.minecraftforge.gradle.common.util.MavenArtifactDownloader._download(MavenArtifactDownloader.java:169) at net.minecraftforge.gradle.common.util.MavenArtifactDownloader.gradle(MavenArtifactDownloader.java:83) at net.minecraftforge.gradle.common.tasks.JarExec.lambda$new$0(JarExec.java:78) <153 internal lines> Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Cannot resolve external dependency net.minecraftforge:ForgeAutoRenamingTool:1.+ because no repositories are defined. Required by: project :

Task :compileJava FAILED 1 actionable task: 1 executed

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':compileJava'.

    Could not resolve all files for configuration ':compileClasspath'. Cannot resolve external dependency net.minecraftforge:forge:1.16.5-36.2.42_mapped_official_1.16.5 because no repositories are defined. Required by: project :

And it still throws that error even I had connected after that, unless I stop all daemon and starting a new one. Seem like it's always download net.minecraftforge:ForgeAutoRenamingTool:1.+ when starting a new daemon. While I already had all dependency downloaded.

Then what's the point of using --offline if it can bypass connection like that?

This problem wasn't happened on mdk 36.2.34 with ForgeGradle 5.1.+

LexManos commented 1 month ago

I think it has to do with gradle always wanting to resolve dynamic versions even if offline. You can try reobfJar.tool = 'net.minecraftforge:ForgeAutoRenamingTool:1.0.6:all' and see if that allows gradle to resolve the artifact without needing the internet.

But ya, honestly, --offline isn't something people actually use. the internet is needed for everything these days.

SAOS-IT commented 1 month ago

Unfortunately that didn't, so I switched to mdk 36.2.34 for more stability, but thank you for your response.

LexManos commented 1 month ago

I mean.. it uses the same FG version, so that doesn't change anything. But sure.