How to distribute a custom gradle plugin in a custom gradle distribution

I have created a custom gradle plugin; I have access restrictions around using maven repo(s) and will not be able to use it by publishing it.

I would like to create a custom gradle distribution with the custom gradle plugin included. and would like to be able to use that to apply my custom plugin.

I couldnt find any direction on best way to create custom gradle distribution. For example, would it be sufficient if i drop the plugin jars in a /lib/plugins or any other specifics.

Once the custom gradle distribution is created and installed, would i be able to apply the plugin with standard procedures ? Example apply plugin: “gradle-custom-plugin”

I have come across the following links, that were helpful but have a few clarifications.

The below link provides a way to use init.gradle and build.gradle to apply a custom plugin.

I realize there is also an open unresolved issue (Cannot load custom plugin (from outside distribution) to project from an init script)
https://issues.gradle.org/browse/GRADLE-2407

Does that mean, this restriction is only if we are intending to use init script ? And would we be able to follow the standard process similar to apply plugin: ‘gradle-custom-plugin’ if we take any alternate approaches ?

Thank you!

You can include an init script in your custom distribution. This init script can put your plugin on the project’s build script classpath:


rootProject {
  buildscript.dependencies {
    classpath files("${initscript.sourceFile}/../../lib/myCustomPlugin.jar")
  }
}

Thank you;
I could not get it to work using ${initscript.sourceFile} instead used ${initscript.sourceFile.parentFile} based on the discussion in Best approach to apply custom plugin to root project via init script in a custom distribution

// Make the SINGLE plugin visible to all projects, by including it in the build script classpath. rootProject { buildscript.dependencies { classpath files("${initscript.sourceFile.parentFile}/../lib/plugins/samp1-1.0.0.jar") } }

It was also helpful to include multiple plugins by pointing to the directory instead of specific file.
// Make MULTIPLE plugin visible to all projects, by including it in the build script classpath. include filter is Optional rootProject { buildscript.dependencies { classpath fileTree(dir: "${initscript.sourceFile.parentFile}/../lib") } }