What is SpongeStart
SpongeStart is a gradle plugin for developing Sponge plugins. I coded this plugin because ForgeGradle was just taking to long for me.
- Preparing the build.gradle:
2. Execute the gradle task:
gradle setupServer. This command will make servers in the folder “run”. Same like forgegradle does.
3. Refresh Gradle in your IDE.
Problems you may encounter
- Your IDE can’t find StartServer.
Try to refresh gradle in your IDE.
- Make the plugin more robust
- Error messages that make sense
- Add eclipse support
How does it work
The plugin itself can basically start any server.jar file. The way it works is by loading the jar in to the systemclassloader (it’s tricky trust me) and invoking it’s startup class. So when Intelij (or another IDE) runs the classfile (StartServer.class) it also loads in the classpath from your project. Something that has to be noticed, is that this won’t work if your SpongeAPI dependencies are set to a compile scope. The way java works is that the parent class loader always gets priority, meaning that possible ASM modifications in the API could be overwritten. That’s why it is important that all SpongeAPI dependencies are set to Provided.