How to add forge dependency?

When i running ‘gradlew eclipse’ in cmd of plugin project folder,get fail:

C:\work\workspace\mfbl_common_plugin>gradlew eclipse
This mapping ‘stable_39’ was designed for MC 1.12! Use at your own peril.
Could not resolve: net.minecraftforge:forgeBin:1.12.2-
:extractNatives SKIPPED
:extractUserdev UP-TO-DATE
:getAssetIndex UP-TO-DATE
Current status: 1244/1305 95%
:makeEclipseCleanRunClient FAILED
FAILURE: Build failed with an exception.

I read doc:Using MCP in Plugins,When I follow the documentation, i still can’t visit e.g. EntityPlayer class. i’m not sure whether it is ‘teach me use mc code in sponge’

I actually want to rely on the MC code, Someone know how to do that?

You need to run gradlew setupDecompWorkspace eclipse

of course i did.But fail, following is my build.gradle file, can you take a look for me?

That’s not very helpful. What specifically happened?

I’m afraid not, maybe i can print some debug trace.

You’re afraid not what? You can’t describe what happened?

I want add minecraft code dependency to sponge plugin, Actually, i should run 'gradlew setupDecompWorkspace ’ then ‘gradlew eclipse’ , but i develop 1.12.2forgeMod before, so i think i don’t neet run ‘gradlew setupDecompWorkspace’. when i run ‘gradlew eclipse --stacktrace’, show:

the full log:

Yes you do still need to run setupDecompWorkspace.

But, if i run setupDecompWorkspace, my mod project forge dependency will invalidate, how to avoid that? (sorry i am not understand forgegradle)

I have no idea what this means. However, setupDecompWorkspace only operates on the current workspace (it’s in the name). If you work on other forge mods, it should not affect those mods’ projects.

On forge docs describe:

Open up a command prompt in the folder you created in step (3), then run gradlew setupDecompWorkspace . This will download a bunch of artifacts from the internet needed to decompile and build Minecraft and forge. This might take some time, as it will download stuff and then decompile Minecraft. Note that, in general, these things will only need to be downloaded and decompiled once, unless you delete the gradle artifact cache.

So I think it only runs once, and i also try run ‘setupDecompWorkspace’ then run ‘eclipse’, the problem is same.

This is log, I ran it 3 times,
1 setupDecompWorkspace
2 eclipse
3 eclipse --stacktrace

Your build.gradle file is not configured correctly.
Specifically, you’re missing the runDir property on the minecraft section.
It should look something like this:

minecraft {
    version = '1.12.2-'
    mappings = 'stable_39'
    runDir = 'run'

The runDir is the working directory that you should use to run the server/client in. ForgeGradle generates eclipse run configs based on this.

Successful! Thank you for you all!

I have a similar problem with the :makeEclipseCleanRunClient task but get a different error. It says:

  • What went wrong:
    Execution failed for task ‘:makeEclipseCleanRunClient’.
    javax.xml.transform.TransformerException: C:\ (Das System kann den angegebenen Pfad nicht finden)

@RS_Gaming, what is your build.gradle?

Oh I already fixed it, but thanks

I had to switch to 64 bit java