[Solved] How to properly depend on Sponge API with Gradle

Okay, so I’ve ran into so many issues now prior to and post getting things to work. Somehow things will randomly just go astray so I’m here to get the final how-to on depending on SpongeAPI with Gradle.

One of my current issues that still has not been resolved can be found here: SLF4J and Inject, although I’m not even able to attempt to solve it as a new issue has appeared out of nowhere.

So out of frustration with the above linked issue, I simply left it and began working on other standalone plugins (the issue above is now about fatJar packaging JARs I don’t want- wasn’t at the beginning btw). Which was working great, I’ve been working on plugins such as Cortex and other personal ones until today I started getting the following error:

Here’s the build.gradle:

The reason I use transitive = true is because without it I get this error:

If anyone can advise me on how to fix this, do it properly, or inform me that I am do this in an utterly idiotic way please do as at this point I’m getting very irritated with all the problems I’m getting with simply depending on sponge.

Any and all feedback is much appreciated as always.

Why are you appending @jar to the end of your dependency?

Just use:

dependencies {
    compile "org.spongepowered:spongeapi:2.1-SPANSHOT"

try "compile org.spongepowered:spongeapi:2.1-SNAPSHOT" works for me

1 Like

You sneaky ninja :stuck_out_tongue:


Read the comments on this commit: Temporarily use the latest flow-noise version · SpongePowered/SpongeAPI@d7f289b · GitHub

I had a similar issue and had to add a line for flow noise, I think it has since been fixed.

I still have no idea where your google inject and slf4j errors are coming from.