plugin-template

Gradle conventions

We have a set of Gradle convention plugins for common configurations (ex. setting up papermc, publishing, tests). You can find docs for them here.

To load them, we need to add our own maven repositories in settings.gradle.kts:

pluginManagement {
    repositories {
        gradlePluginPortal() // default gradle plugins repo
        maven("https://repo.mineinabyss.com/releases") // our own
        maven("https://repo.mineinabyss.com/snapshots")
        maven("https://papermc.io/repo/repository/maven-public/") // needed for papermc
    }
    // You may also include a local build of our conventions plugins if you want to test out changes locally!
    // includeBuild("../gradle-conventions")
}

Idofront creates version catalog entries for each convention and references the main repository so you can get the latest conventions just by updating idofrontVersion in gradle.properties. These look like this in build.gradle.kts:

plugins {
    alias(idofrontLibs.plugins.mia.kotlin.jvm)
}

Conventions with submodules

Gradle currently has a quirk when a parent module loads a plugin via alias and a child module tries to load the same plugin. Since alias includes a plugin version it will throw an error due to a version being declared twice. You can see us doing this in geary-papermc

In such cases, switch to the following id notation in subprojects:

plugin {
    id(idofrontLibs.plugins.mia.kotlin.jvm.get().pluginId)
}

It's also good practice in Gradle to declare all the plugins you will be using in the root build.gradle.kts with apply false at the end, then use the id notation shown above. In our case this mostly just helps you see which conventions are used by a project and prevents errors if you ever end up adding an alias to a parent module and forgetting to update the child.

plugins {
    alias(idofrontLibs.plugins.mia.kotlin.jvm) apply false
}