Skip to content

Instantly share code, notes, and snippets.

@Turbojax07
Last active January 6, 2026 01:41
Show Gist options
  • Select an option

  • Save Turbojax07/d67800b9516875a2ae63958e2e510349 to your computer and use it in GitHub Desktop.

Select an option

Save Turbojax07/d67800b9516875a2ae63958e2e510349 to your computer and use it in GitHub Desktop.
Turbo's Gradle Tasks

These are just gradle tasks I make that I think are kinda useful. Open to the public!

inject: Combines a source jar file and a second patch file. Useful when editing an existing jar file.

ext {
    sourceJar = <abs/relative path>
    patchedJar = <output>
}

task inject(type: Zip) {
    delete "unpacked"
    duplicatesStrategy = "include"

    from zipTree("build/libs/${rootProject.name}-${version}.jar")
    into "unpacked"
    
    from zipTree("${sourceJar}")
    into "unpacked"

    from "unpacked/"
    include "*"
    include "*/*"
    archiveFileName = "$patchedJar"
    destinationDirectory = layout.buildDirectory

    delete "unpacked/"
}

resetAndRun: Useful for minecraft plugin development. Deletes existing configs and plugin data to allow the new version to overwrite them.

task resetAndRun {
    delete "run/plugins/$rootProject.name"
    finalizedBy(runServer)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment