unldenis / holoeasy

a simple and modern Java and Kotlin minecraft hologram library for 1.8-1.20.4 servers.
https://unldenis.github.io/holoeasy/
GNU Lesser General Public License v3.0
86 stars 26 forks source link

NoClassDefFoundError #19

Closed boppescripting closed 2 years ago

boppescripting commented 2 years ago

image

Whenever I attempt to run my sever, my plugin is stopped with the above error. ProtocolLib is added to my plugins folder and added as a dependency for my plugin.

Gradle Build File

plugins {
    id("java")
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
    maven("https://jitpack.io")
}

dependencies {
    compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
    implementation("com.github.unldenis:Hologram-Lib:master-SNAPSHOT")
}

tasks.getByName<Test>("test") {
    useJUnitPlatform()
}

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}
boppescripting commented 2 years ago

Resolved by adding the below to my build.gradle.kts:

tasks.withType<Jar> {
    // Otherwise you'll get a "No main manifest attribute" error
    manifest {
        attributes["Main-Class"] = "com.Example.Main"
    }

    // To add all of the dependencies
    from(sourceSets.main.get().output)

    dependsOn(configurations.runtimeClasspath)
    from({
        configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
    })
}