How to compile my plugin?

There’s not really a clearly explained way of doing this.

plugins {
    id 'org.spongepowered.plugin' version '0.6'

group ''
version '1.0-SNAPSHOT'

dependencies {
    compile 'org.spongepowered:spongeapi:5.0.0-SNAPSHOT'

Using the build gradle task generates a jar that Sponge does not register as a valid mod.
Adding an artifact with compile output only generates a valid mod but it reports is missing even though I have annotation processing enabled.

Is your main plugin class annotated with @Plugin?


As I said, the Gradle build task is what produces a invalid mod that Sponge can’t load.
Building as an artifact produces a valid mod but fails to bundle the file with it.

Asked around in IRC and discovered that my sources structure is wrong. For anybody who encounters this issue, make sure your sources are in src/main/java!

1 Like