Make gradle plugin optional

I made a gradle plugin that i want to use via MavenLocal in some of my projects.
This plugin is not neccessary for a compile, but merely a utility for testing it.
Is there any way i can add this as an “Optional Plugin” so that if someone else were to compile my project, they wouldnt need the testing plugin just to build the artifact?

Use case:
Minecraft Test Server Plugin, to be used in Minecraft Plugins. Obviously not needed for the plugin to build.

1 Like

Declare the plugin as a buildscript dependency instead of an apply statement. This will make the plugin a build-time only dependency, which means that it will not be applied to the project during the build. Instead, you will need to apply the plugin manually using the apply statement if you want to use it.

buildscript {
    dependencies {
        classpath 'com.example:my-testing-plugin:1.0'