Need some help Importing Sponge into IntelliJ

Hello,

This may be a dumb question to answer and a easy fix but I cant see it.
I am new to Sponge Plugins Development and am looking to find information to fully utilize IntelliJ.

I have came across this link the the Sponge Docs -
https://docs.spongepowered.org/master/en-GB/plugin/tutorials.html

I am trying to follow all three of these tutorials to the best of my ability although I have already ran into a problem following the first tutorial. Here is the first tutorial -

I tried to follow this video as best as I could. I saw he had Git Bash installed and I didnt. So I went ahead and installed that from https://git-for-windows.github.io/.

I then ran the ‘git clone --recursive https://github.com/SpongePowered/Sponge.git’ via Git Bash onto a folder in my desktop and waited for everything to download.

After downloading I imported the file into IntelliJ and loaded the dependence’s the workspace ect like the video showed. It worked for the most part although I was getting some errors. I forgot exactly what they said although I do remember something was not defined.

Right from the get go when I loaded IntelliJ I noticed some of the files were different. The first thing I noticed was the file was called SpongeForge instead of just Sponge. The next thing I noticed was under Build there was not dirtyArtifacts like there was on the video.

After sort of ignoring this I moved on to the second tutorial video installing the sponge minecraft server and integration into the IntelliJ Workspace here -

On this video I noticed he was able to make the path users/sponge/Sponge/run/server and if you notice there is a Run package in his IntelliJ directory which I did not have.

(NOTE: I did remove these files and no longer have access. I tried to be as descriptive as posible and I hope with the information provided someone is able to help me generate new working files for me to further my Sponge Plugin Development.)

I hope someone understands and can help me with his issue as soon as possible. Any help is appreciated and thanks in advance!
-Jake

Unfortunately, the Tutorial vids are a bit old, and some of the information is out-of-date. We need some fresher tutorials to replace them, but it hasn’t been a high priority.

Hello Inscrutable,

Thanks for the quick reply! Do you think you could help me out with installing this?

-Jake

https://docs.spongepowered.org/master/en/plugin/workspace/idea.html
Have you read through this it is pretty great written tutorial.
As for integrating the server, I actually haven’t done that myself but it’s supposed to be not so difficult.

I think using gradle is 20 times easier than those tutorials up there. Make the project, give it a name, add the repo and dependency and bam you’re ready to code after running build.gradle

Hello curscascis,

This is how I previously tried. I built a Gradle Project then just imported the API and maven. Although I believe this does work I do not know the difference between this method and the method I have explained above linking the tutorials. I also do think that you cant* integrate your server in IntelliJ workshop using this method. None the less thanks for your reply :slight_smile:

Well I’m not certain but it seems that first video above is to import sponge as a project, instead of having it as a dependency to use to make a plugin. Are you trying to add to sponge or make a plugin?

Im trying to create a plugin although im confused as to which is which.

Make a new project in IntelliJ, Do not import one, just make a new gradle java project. After, edit build.gradle to reflect

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

group = 'com.example' // TODO
version = '1.0-SNAPSHOT'
description = 'An example plugin'
    
repositories {
        mavenCentral()
        maven {
            name = 'sponge'
            url = 'http://repo.spongepowered.org/maven'
        }
    }

    dependencies {
        compile 'org.spongepowered:spongeapi:5.0.0'
    }

than save it, right click and hit run. It should generate gradle stuff on the right. After this you should be all ready to go. Depending on your settings you may have to create the scr/main/java folder. Make your package with your classes in this folder, it will automatically link in to the sponge stuff. To build your project you open the gradle window (on the right by default, and run build, that should create a build/libs folder with a jar.

I did this before. Still doesnt tell me how to get the server in the workspace.

Oh I understand, I actually Just send my plugin via ssh for testing, I’ll see if I can figure it out. In the mean time hopefully someone else knows how.

1 Like

SO I came across this, a little busy so can’t test it but it might be what you’re looking for.

pie_flavor has recommended it in a past post.

A little shameless self-promotion, I created some tutorials. Now while I am on windows and, based on those tutorials above it seems like you’re on OS X, I still believe they could be much of use to you.
You can check them out here

1 Like

No Shame in Helping out the community :stuck_out_tongue: You beat me to making videos.

1 Like

Wow, I do not believe it. I have already came across your videos and watched them a few times now. They are well put together. Thanks for replying although I am on Windows 10 I did not make the tutorials above.

Thanks. Im just about to go to sleep soon so if you are able to test it before I do that would be great.

So i watched through your videos, this is pretty much the default way I think mostly everyone does, I think what we were talking about (atleast me) is that you used to be able to run a build script that what just take your src files put them in with the sponge server source and start the server completely from your work space, without having to manage anything externally. But seriously pretty good quality.

YesI know exactly what you’re talking about and it is how I run and debug my plugins, with run configurations in intelliJ is what I assume you’re talking about?

The way I currently do this, not saying this is the best, but I create a new Run Configuration (Gradle) I add three things to the before launch area: Build ‘PLUGIN_NAME’ Artifact, Run Gradle Task ‘PLUGIN_NAME’ Build, and I then create an external tool as you will see that option show up. Within the external tool window I created a new one Called Start Server, set the program to my servers start.bat and set my working directory to the server directory. After this you should have three things in this order, from top to bottom, Build Artifact, Run Gradle Task, and External Tool.

You might ask why I have run gradle task as a before launch task and thats because it would be kind of pointless to build in gradle after the server started and have a pointless server started.

Two ways of doing it:

  1. SpongeStart Gradle plugin works out of the box, it’s really handy! I prefer this over method 2.

  2. Clone SpongeForge or -Vanilla as described in the README on GitHub, also do the setupDecompWorkspace. Then clone your plugin into the Sponge folder. Import the Sponge project in IntelliJ, and import your plugin as a module. Set that new module as a dependency of ‘Sponge java_6’ or something like that(I should do some screenshots). Then execute gradle genIntelliJ. A new run configuration appeared. Edit it to have that ‘sponge java6’ as module. Then you can run the configuration and the server should start with your plugin.

Thanks everyone for the responses. I will try and figure it out using the video from intronate67 and using the plugin from RandomByte.