Closed JamieIsGeek closed 1 year ago
Hey,
I think the problem is that SpiGUI is not being included in your plugin (however it is designed to be and normally is, although it could be included in a standalone plugin).
The simplest fix should just be to change compileOnly
to compile
for the SpiGUI dependency.
FYI: compileOnly
is for dependencies whose API is required at compile time but whose implementation is to be provided by a consuming library, application or runtime environment. compile
provides the API and the implementation (i.e., at compile time and at runtime) - there is also implementation
which is only at runtime.
Unfortunately compile
isn't a method acoording to my gradle build error and using implementation
provides the same error as the initial issue
Ah, seems they’ve finally removed compile
from Gradle 7+ so I think I need to revisit my Gradle classpath knowledge. This site says that they’re now compileOnly
, runtimeOnly
, and implementation
(where implementation is both compile and runtime).
In any case implementation
shouldn’t have had the same error - are you sure the Gradle configuration was refreshed?
Yep 100% sure it was refreshed
Strange… I’ve not run into this myself, I’ll try making a minimal test with the latest versions.
Any update on this?
Yep, managed to reproduce the issue and solve it. implementation
tells Gradle it should be included in the runtime classpath, but we also need to shade SpiGUI into the JAR. This can be done by adding the following to your build.gradle
:
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
I'm having an issue where when I try to load the plugin on a server I get this error "java.lang.NoClassDefFoundError: com/samjakob/spigui/SpiGUI" Here is the implementation in the build.gradle file:
Any help would be lovely :D