I have a plugin living in buildSrc that is published to mavenLocal every time the buildSrc is built. I now want to use the published version of the plugin from mavenLocal() in my settings.gradle.kts.
What I have come up with so far is to declare a dependency to the published artefact in my settings.gradle.kts and then applying the plugin in the following way:
By default (in <Gradle 6.0), the buildSrc.jar is already on the classpath for the settings script, so even though you’re adding your plugin separately, it’s actually being loaded from the buildSrc copy.
The easiest thing to do would be to either
Stop using buildSrc if you don’t have anything else in it.
Move the plugin code into a buildSrc subproject (it won’t be included on the classpath)
Thank you, Sterling! I’ll definitely give your suggestion a try attempting to move the plugin into a subproject. But in general:
Do you find the strategy of publishing to maven local and then loading therefrom to be a reasonable way to fulfil the contract of not accessing buildSrc project in settings scripts today, before G6 is out?
Does G6’s choice to always put the buildSrc.jar on the classpath mean that it is perfectly legal for us to keep applying plugins from buildSrc in our settings scripts paying little attention to the deprecation warning since these plugin will remain accessible via buildSrc.jar, right?