Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Support with using relocate from method #100

@OakLoaf

Description

@OakLoaf

Please check the User Guide before submitting "how do I do 'x'?" questions!

Shadow Version

8.1.7

Gradle Version

8.6

Query

I am trying to use relocate from to make sure I am only relocating net.kyori in the packetevents dependency. I make use of the same library but as a soft-dependency in my ChatColorHandler library which is breaking due to the relocation changing the imports.

I am just not entirely sure how to make of the from method in relocate to make this correctly work. You can see my current not working attempt below.

Gradle Build Script(s)

plugins {
    `java-library`
    `maven-publish`
    id("io.github.goooler.shadow") version("8.1.7")
}


group = "org.lushplugins"
version = "2.0.0-BETA"

repositories {
    mavenCentral()
    mavenLocal()
    maven(url="https://oss.sonatype.org/content/groups/public/")
    maven(url="https://hub.spigotmc.org/nexus/content/repositories/snapshots/") // Spigot
    maven(url="https://ci.ender.zone/plugin/repository/everything/") // Essentials
    maven(url="https://repo.opencollab.dev/main/") // Floodgate
    maven(url="https://repo.lushplugins.org/snapshots/") // LushLib
    maven(url="https://repo.codemc.io/repository/maven-releases/") // PacketEvents
    maven(url="https://repo.extendedclip.com/content/repositories/placeholderapi/") // PlaceholderAPI
    maven(url="https://jitpack.io") // EntityLib, GSit
}

dependencies {
    // Dependencies
    compileOnly("org.spigotmc:spigot:1.20-R0.1-SNAPSHOT")

    // Soft Dependencies
    compileOnly("org.geysermc.floodgate:api:2.0-SNAPSHOT")
    compileOnly("net.ess3:EssentialsX:2.18.1")
    compileOnly("com.github.Gecolay.GSit:core:1.9.0")
    compileOnly("me.clip:placeholderapi:2.11.2")
    compileOnly(files("libs/SimpleSit.jar"))

    // Libraries
    implementation("com.github.retrooper.packetevents:spigot:2.3.0")
    implementation("com.github.Tofaa2.EntityLib:spigot:2.2.1-SNAPSHOT")
    implementation("mysql:mysql-connector-java:8.0.25")
    implementation("org.lushplugins:LushLib:0.6.1")
}

java {
    toolchain.languageVersion.set(JavaLanguageVersion.of(17))
}

tasks {
    withType<JavaCompile> {
        options.encoding = "UTF-8"
    }

    shadowJar {
        relocate("net.kyori", "org.lushplugins.followers.libraries.kyori") {
            from(files("com/github/retrooper/packetevents", "io/github/retrooper/packetevents"))
        } // Provided by PacketEvents
        relocate("com.github.retrooper.packetevents", "org.lushplugins.followers.libraries.packetevents.api")
        relocate("io.github.retrooper.packetevents", "org.lushplugins.followers.libraries.packetevents.impl")
        relocate("me.tofaa.entitylib", "org.lushplugins.followers.libraries.entitylib")
        relocate("com.mysql", "org.lushplugins.followers.libraries.mysql")
        relocate("org.lushplugins.lushlib", "org.lushplugins.followers.libraries.lushlib")

        minimize()

        val folder = System.getenv("pluginFolder_1-20-6")
        if (folder != null) destinationDirectory.set(file(folder))
        archiveFileName.set("${project.name}-${project.version}.jar")
    }

    processResources{
        expand(project.properties)

        inputs.property("version", rootProject.version)
        filesMatching("plugin.yml") {
            expand("version" to rootProject.version)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions