Updating the Sponger Server Jar file

I noticed that the prefix to the website that you download the sponge jar has a “repo” prefix. Does this hint at maven / gradle style updating? And if so, how can I get started with that, because I have been manually updating my server file daily and I would much prefer some sort of method of update.

I am not an expert here, but it seems like you can build the source on SpongePowered GitHub with gradle.

Yeah, but I just want the releases updated, not the entire project. And sort of have a system simular to what spigot has done with the auto-updating of the server releases. Also I am running Vanilla-Sponge.

It’s a maven repo.

Ahh, then thats beyond what I can tell you, sorry.

I haven’t really played with that stuff too much, should I just write a bash script to do it? or should I use java? or is it already done.

@ the moment,write your own.

how would go about updating the maven repo from the command line?

A maven repo isn’t a git repo. So you don’t maintain a local copy that you update. There are serveral libraries that can fetch from maven in many languages. Just pick a language you’re comfortable with and make it grab the latest artifact from the repo.

1 Like

Using the version LATEST should work.

The version LATEST is not working for me :c @ryantheleach

Doesn’t Work :

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
    -DrepoUrl=https://repo.spongepowered.org/maven/ \
#                                       ^^^^^^ The Problem

Does Work :

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
    -DrepoUrl=https://repo.spongepowered.org/maven/ \
#                                       ^^^^^^^^^^^^^^^^^^^

^^ But this isn’t that useful xD also don’t know where the file was downloaded

I use this python script to update my sponge jar. You only need requests and wget to get it working ;).

from lxml import html
import requests
import wget
import os
page = requests.get('https://repo.spongepowered.org/maven/org/spongepowered/sponge/')
data = html.fromstring(page.text)
newspongeurl = data.xpath('//a[@class="uk-button uk-button-primary"]')[0].attrib['href']
wget.download(newspongeurl, "sponge.jar")
1 Like

I will give this code a try :smile: thanks for your input

1 Like

This isn’t ideal I think. Because if there is an error when downloading the file you don’t have anything anymore. It’s better if you download the file first (rename the old one?) and delete the old one if the download succeeded.
I don’t think the chance of an error is big but it is always there when you don’t expect it.