SpongeStart Gradle plugin

No, this is just for SpongeAPI plugins. If you need forge use forgegradle.

I am getting spammed with this: ILikeVanillaNotchCream.log Ā· GitHub

Is this issue with this or is it sponge issue? only happens with vanilla

Thatā€™s an issue with vanilla I think. You might want to try an older build.

sponge{
   eula true
   spongeVanillaBuild '246'
}

Than execute:
gradle setupVanilla

It canā€™t find the plugin, yet I copied the buildscript section off your code.

> Plugin with id 'SpongeStart' not found.

Figured it out. Itā€™s indeed my plugin that is causing the issue. Let me explain the problem:
When your IDE starts StartServer it add the classes from the IDE class-path to the launchparameters. The problem is the SpongeAPI dependency from gradle. They conflict with the classes from the server. And because they are loaded first get all the priority. A way to solve it is to set your SpongeAPI as a PROVIDED dependency.

I probably will have to redesign the plugin to overcome this problem sadly enough :confused:. The classloader doesnā€™t understand priority and unloading classes has been made totally impossible.

You need to start it like this:

apply plugin: 'SpongeStart'

Thatā€™s what Iā€™m already doing.

The buildscript and apply are in a template script I run from all my plugin project scripts.

Can you post me your build.gradle?

apply from: "../template.gradle"

archivesBaseName = "..."
version = projectData.mcversion + "-" + projectData.version
group = "..." // http://maven.apache.org/guides/mini/guide-naming-conventions.html

Hereā€™s ../template.gradle

buildscript {
	repositories {
		mavenCentral()
		maven {
			url = "https://jitpack.io"
		}
	}
	dependencies {
		classpath "com.github.qixalite:SpongeStart:1.1"
	}
}

repositories {
	mavenCentral()
	maven {
		name = "sponge"
		url = "http://repo.spongepowered.org/maven"
	}
}

apply plugin: "java"
apply plugin: 'SpongeStart'

dependencies {
	compile "org.spongepowered:spongeapi:3.1.0-SNAPSHOT"
	compile fileTree(dir: "libs", include: "**.jar")
}

sponge {
	eula true
}

def buildProperties = new Properties()
buildProperties.load(new FileReader(file("build.properties")))

task projectData {
	ext.version = buildProperties.version_major + "." + buildProperties.version_minor + "." + buildProperties.version_revision + "_B" + buildProperties.build
	ext.mcversion = "1.8"
}

task update << {
	// ...
}

processResources {
	from sourceSets.main.java.srcDirs {
		include group + "." + archivesBaseName
		expand "version"
	}
}

sourceSets {
    main {
        java {
            srcDirs = ["src"]
        }
    }
}

Hmmm, At this point I am clueless why it canā€™t find the plugin. Can you check if maven actually downloaded the plugin? It should be located at:

Unix: ~/.gradle/caches/modules-2/<metadatafolder>/descriptors/com.github.qixalite/SpongeStart
Windows: %HOMEPATH%\.gradle/caches/modules-2/<metadatafolder>/descriptors/com.github.qixalite/SpongeStart

The JAR is in .gradle/caches/modules-2/files-2.1/com.github.qixalite/SpongeStart/1.1/322d9440202077300ad18e71b49597524d0d8497 and a few of the metadata-# directories contain the ivy.xml (one of them also has the .pom).

Lol this is getting crazy. Everything is there and still it canā€™t find it :frowning:. Although I never worked with apply from: I donā€™t think that should be the problem. All I could possibly think if is deleting the gradle caches and retryā€¦ .

It redownloaded it, but still does not work.

Download https://jitpack.io/com/github/qixalite/SpongeStart/1.1/SpongeStart-1.1.jar`

Sadly, setupServer stops at 57%: SpongeStartNotContinuing.txt Ā· GitHub

My setup https://github.com/randombyte-developer/LongMessages without the run folder.

You probably didnā€™t clone the repo recursively.

The buildscript object need to be in build.gradle

@RandomByte
Iā€™ve experienced the same issue. Sometimes restarting the IDE or task fixes it, but not often. Definitely a bug of some sortā€¦ Not sure if its in the forge installer or SpongeStart.

Edit: And it always stops on that lzma libraryā€¦

Thatā€™s really annoying because I want the least possible amount of code inside the build.gradle.
Is there no way of having the buildscript outside it?

To give you guys an update. For those who have been watching the repo, you will see that I did some really but really stuppid shit xD. (I am cherrypicking the good parts and moving it to this branch atm)

Anyway upcoming update:

  • Finally fixed crash with LZMA on windows
  • Finally fixed dependency overwriting
  • Dropped eclipse support :cry:
  • Automatic task generation

At this point I am just adding extra filtering for the spongeapi dependencies. Since only those should be filtered when you start.

I run the jarā€™s directly using a custom classloader, no need for cloning :stuck_out_tongue:.

Is there no way of having the buildscript outside it?

Yes. But thatā€™s not really an issue that you should expect SpongeStart to solve. How you want to setup your code is entirely up to you - weā€™re just providing the information thatā€™s necessary.

A quick google search will net you a plethora of tutorials which explain multi-file gradle setups.

Updated to 1.4
Feature Changes:

  • Finally fixed crash with LZMA on windows
  • Finally fixed dependency overwriting
  • Dropped eclipse support
  • Automatic task generation
  • Only set SpongeApi dependencies to provided.

What happend to 1.2 and 1.3?
Well those plugins are kinda not working. They use the jar launcher of intellij, what is ahum not working. And I only noticed it after 6 hours of happy coding (what resulted in very unhappy coding). Soooo, I just walked 7 rounds around the house thinking how I possible could avoid getting dependencies from the classpath getting mixed with the runtime environment. Well than I suddenly thought PROVIDED, and solved the problem under the 45 min. Kinda a crazy story but pretty much sums up my day.

1 Like