Jump to content

How do I add other mods as dependencies in build.gradle with ForgeGradle 4.1+?


Recommended Posts

Posted (edited)

I'm starting a new mod from scratch. I have very little experience, so let me know if you need any more information, and please be patient with me.

In past mods, such as this one (build.gradle) I've been able to add dependencies so that runClient would load mods that mine depended on. It looked something like this:

dependencies {
    minecraft 'net.minecraftforge:forge:1.16.4-35.1.28'

    compile fg.deobf("curse.maven:mgui:3104239")
    compile fg.deobf("curse.maven:tetra:3232294")
    compile fg.deobf("curse.maven:citadel:3198842")
    compile fg.deobf("curse.maven:ice-and-fire-dragons:3217622")
}

However, this method does not work with my new mod (GitHub, build.gradle). When I try running runClient, it produces this error message:

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find curse.maven:citadel:3198842_mapped_official_1.16.5.
     Searched in the following locations:
       - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/citadel/3198842_mapped_official_1.16.5/citadel-3198842_mapped_official_1.16.5.pom
       - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/citadel/3198842_mapped_official_1.16.5/citadel-3198842_mapped_official_1.16.5.jar
     Required by:
         project :
   > Could not find curse.maven:ice-and-fire-dragons:3217622_mapped_official_1.16.5.
     Searched in the following locations:
       - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/ice-and-fire-dragons/3217622_mapped_official_1.16.5/ice-and-fire-dragons-3217622_mapped_official_1.16.5.pom
       - file:/C:/Users/REDACTED/.gradle/caches/forge_gradle/bundeled_repo/curse/maven/ice-and-fire-dragons/3217622_mapped_official_1.16.5/ice-and-fire-dragons-3217622_mapped_official_1.16.5.jar
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

I have tried copying over the buildscript {} section at the top of the build.gradle file from Tetranomicon (which works) to the new mod (which doesn't), but that doesn't help. I thought it might because it seems to declare repositories, as the error message suggests.

The main difference between the two projects that I can see is that the new one uses ForgeGradle 4.1+ while the old one uses ForgeGradle 3+. (I get error messages about gradle versions if I try changing from one to the other.) Did the format for declaring and importing dependencies change with the update?

Thank you for the help!

Edited by Syric
typo
Posted

The format did not change, FG4 runs on a newer version of Gradle than FG3 does, also these errors usually indicate something went wrong earlier in the process, please provide the full console history

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted
  On 6/2/2021 at 12:47 AM, DaemonUmbra said:

The format did not change, FG4 runs on a newer version of Gradle than FG3 does, also these errors usually indicate something went wrong earlier in the process, please provide the full console history

Expand  

Is this what you're referring to?

  Reveal hidden contents

 

Posted

That's not really what I meant but I think I see the issue now, are you trying to use the CurseMaven Plugin? Because that's been deprecated in favor of just using https://cursemaven.com as a maven repo (see the site in a browser for more info)

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

Update: as soon as I change 'https://files.minecraftforge.net/maven' to "https://www.cursemaven.com", as cursemaven.com suggests I should, refreshing gradle produces this error:

  Reveal hidden contents

think this means I need to change this line in my build.gradle:

dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
    }

but I'm not sure how I'd go about doing that.

(If you need any more information, please ask for it- I'm quite a bit out of my depth here.)

Posted

You know that line in the MDK that says not to edit anything above it (indicating the buildscript block) that you messed with? Yeah reset that to how it comes in the MDK.

The buildscript is entirely separate from the rest of the build.gradle, it signals what Gradle is going to need to set up to be able to interpret the rest of the file, so if you need to add a repo to your project, add it to a repositories block OUTSIDE of buildscript.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

Thank you for the help! I got it to work... in theory, at least. One of the two mods I need to import works fine. The other crashes, for some reason, despite the fact that I've a) played with that version of the mod just fine and b) imported it as a dependency just fine.

Here's the build.gradle for another mod, where I successfully imported citadel and ice-and-fire-dragons.

Here's my current build.gradle. Citadel works, but as soon as I add Ice & Fire, the game crashes with this log. It says it's a problem within Ice & Fire, but since it works in those other contexts I'm somewhat doubtful.

Any idea how to fix or work around this?

Posted

Looks like Ice and Fire uses code that breaks when deobfed to official names, you'll have to use mcp

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.