SpongeStart Gradle plugin

SpongeStart

:question: What is SpongeStart :question:

SpongeStart is a gradle plugin for developing Sponge plugins. I coded this plugin because ForgeGradle was just taking to long for me.

:hammer:Getting Started! :hammer:

  1. 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.
:boom: Problems you may encounter :boom:

  • Your IDE can’t find StartServer.
    Try to refresh gradle in your IDE.

:pencil: Todo :pencil:

  • Make the plugin more robust
  • Error messages that make sense
  • Add eclipse support

:construction_worker: How does it work :construction_worker:

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.

:octocat: Git :octocat:

10 Likes

Just one question: Do you need to have the Sponge project preinstalled, or will this plugin download it from GitHub, because if it did it would be 100/10

You don’t need a Sponge Project pre-installed. It will download forge and the mod from http://files.minecraftforge.net/, And than clevery (hackery) wrap arround it to make it work :smile:.

To give you an idea here a picture how it looks like:

10010
:slight_smile:

So does the debugger and everything work too? :open_mouth:

Yes it does :blush::

(scarry moment …)

1 Like

Okay, just one more question… Can it auto load plugin dependencies?

Like have some configuration for certain maven artifacts that should also be loaded as plugins?

Anyway, its already awesome, considering Git wasn’t cooperating when I tried to clone the Sponge project…

As long your IDE has it in his classpath, it will work.[quote=“meguy26, post:6, topic:11318”]
Anyway, its already awesome, considering Git wasn’t cooperating when I tried to clone the Sponge project…
[/quote]
Yeah that was also 100% bugging me. I tried to make a plugin 3 days ago, mangled 3 hours with the repo. Gave up and just made this gradle plugin xD.

My mind was already blown, and now its more blown. Gg.

2 Likes

Think you can add SpongeVanilla and SpongeForge for client also?

Hmmm, It will require some changes in the installer, and a new run folder. But yeah not a problem :slightly_smiling:.

Ehm, Just did some testing and I figured out that the forge installer doesn’t has a --installClient option :’( . I will see what I can do with it, but atm it has very low priority.

Updated to 1.1
Feature Changes:

  • Added support for SpongeVanilla. Folders are now /run/forge and /run/vanilla
  • Separated download tasks location and proper caching
  • clearing project and cache tasks

build.gradle changes

The sponge block is now only if you want to change the sponge version. The plugin is now smart enough to figure out what the most recent sponge version is. Although having this in your script can be extremely helpfully :slightly_smiling:

sponge {
   eula true
}

Github Repo Changes:

Since I made this plugin for Qixalite we decided to move it to the Qixalite repo’s:

SpongeVanilla is server-only at the moment, and AFAIK there are no plans to add client-side integration.

I know, I was talking about SpongeForge on the client.

Much love cookies and cakes :heart_eyes:

:cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie::cookie:
:cake::cake::cake::cake::cake::cake::cake::cake::cake::cake::cake::cake::cake::cake::cake:

2 Likes

Whoops, I guess I misread your post.

It was supposed to be:
(SpongeVanilla) and (SpongeForge for client)

I read it as:
(SpongeVanilla and SpongeForge) for client

1 Like

I honestly don’t think it is useful to have the client on here. So far I understood you can’t make gui stuff using the API. Or can you?

However it’s useful to test your plugin as a combined server/client setup

I did some testing and it is way to hacky to get the client working :stuck_out_tongue:. It almost feels like a cracked client (it is). I think I just stick to the servers, it’s not so hard to just have a client running in the background where you can alt + tab to.

Will this allow me to use classes from forge?