How to run plugin from IDE (idea)?

Today I started writing Sponge plugin (actually, rewriting plugin I started working on with bukkit). With Bukkit I was able to run my plugin inside my IDE by clicking ‘run’ button. Is is possible with sponge? If so, how to do it in Idea?
Note: I use gradle

Not sure if you can/how you would set it up to run using one of the dev builds, but if you clone the Sponge repo and set it up you can follow these instructions for running a server/client from your IDE: Sponge#running

Build Sponge.

Afterwards, there really isn’t a way (that I know of) to automatically move and add the new build to the mods folder, and then run Sponge from within the IDE. However, you could create a script to do so, that you could run after compiling.

The alternative is to have both Sponge and your plugin modules in the same project, and create the Application configuration as if you’re running sponge, but instead of using Sponge as a module, use your plugin (You also have to manually add a module dependency to your plugin for Sponge). Then you can run it on your server.

2 Likes

With Netbeans IDE (currently I use it for all other projects) and gradle plugin I could add ‘run’ and ‘debug’ gradle tasks. It worked with bukkit (huge buildscript) and forge (adding 3 lines to buildscript).
It would be enough for me if I could run it by executing gradle task. I will try to do it.

I dodn’t see this reply while writing. I will try it.

@Minecrell has a cool idea for this…

@gabizou’s suggestion works.

The way I test my Bukkit & Sponge plugins is the same- I have a build script that I run than compiles the plugin and copies it over to the appropriate directory. I then run another script to run the server, although that could theoretically be added into one script.

Minecrell’s idea comes in the form of a Gradle plugin - https://github.com/Minecrell/SpongeGradle

I have often wished to be able to develop straight to the server just like how Notch could make changes and have it immediately apply to the client.

For standalone applications, the debug mode in Eclipse does this. For plugins, I don’t think that would work.

There’s a way to do it pretty easily, according to @Zidane. He’s working on the documentation for it, whenever he has the free time. He’s very busy, obviously, though. :stuck_out_tongue:

I’m planning on making a few videos for IntelliJ setups:

  • Set up Sponge
  • Setting up your workspace for making a Sponge plugin
  • Debugging your plugin
  • Running Sponge from IntelliJ
4 Likes

Thanks a lot! Would be really helpful.

I actually got it working already. I can run/debug client/server with Sponge from my IDE.
Method described by @gabizou works fine in IntelliJ IDEA.
For most of my projects I use Netbeans IDE, but I’m not sure if running it in netbeans with gradle plugin will ever be possible - it needs run and debug tasks defined in build.gradle and it would need Sponge/SpongeVanilla as runtime dependency.

A little tutorial for this ? Please..

One already exists.

2 Likes

Any tutorials for Eclipse on running and debugging?

1 Like