[Solved] NoClassDefFoundError for GameStartedServerEvent

Hello,

I’m starting plugin development using gradle (eclipse plugin: gradle integration) and having a problem my jar file. When I try to test it using latest sponge dev release (1.8-1499-2.1DEV-591), I encounter this exception :

java.lang.NoClassDefFoundError: org/spongepowered/api/event/game/state/GameStartedServerEvent

Would you have any idea about where this could come from ?

I was just testing a very basic plugin, here is the only class “TestPlugin” : http://pastebin.com/7NkpEscC
And here is my build.gradle : http://pastebin.com/mxNcaaug

Thanks in advance for your help.

The API has some changes that currently aren’t implemented yet. That said plugins developed with the mostcurrent API won’t run on Sponge 591 (but will hopefully on 592).

I’ll just quote @simon816 here:

2 Likes

Ah ok ! Thank you very much ! I’ll use this dependendy for this little test.

Just so I know, how to know which dependency use for a given implementation ?
For example here, how did you know it’s org.spongepowered:spongeapi:2.1-20150828.013112-189 for sponge 591 ?

The latest Sponge build (591) was built from this tree: https://github.com/SpongePowered/Sponge/tree/3c9429f
The SpongeCommon ref in that tree is: https://github.com/SpongePowered/SpongeCommon/tree/8afdffe
The SpongeAPI ref in that SpongeCommon Tree is: GitHub - SpongePowered/SpongeAPI at 2cd91adf9eb9399f9f2f7688531d5ba744b8b738
That commit was pushed on the 28th August: Commits · SpongePowered/SpongeAPI · GitHub

On the SpongeAPI 2.1 SNAPSHOT repo index, dist.creeper.host - 2.1-SNAPSHOT
do a search for “28-Aug-2015” and you will see that the SpongeAPI build number is 189 and you can copy the exact numbers in the file name for the full version reference

2 Likes

Thanks for the detailed answer. I’ll pay more attention to the repo.

A last thing, when I change
org.spongepowered:spongeapi:2.1-SNAPSHOT to
org.spongepowered:spongeapi:2.1-20150828.013112-189
I get an Illegal entry in Gradle Dependencies when refreshing the dependencies

Doesn’t happen to me

Run the command gradle eclipse --refresh-dependencies

You should also have an up-to-date gradle version, for me, gradle --version shows 2.4

Ah my bad, eclipse was configured to use its self wrapper I suppose. I changed its configuration and it works now. Once more thank you very much, you helped me a lot ! :relieved:

1 Like