I’m developing a plugin to be applied to a project’s settings, and am attempting to use a composite build during development.
Including the build works, but it seems I can’t use that same included build within the settings.gradle. It still attempts to find my plugin in a repository.
This doesn’t work yet. It’s a bit of a chicken and egg problem because we need to evaluate settings.gradle (which resolves the classpath without included builds) to get the list of included builds.
What does your Settings plugin do? You might be able to get away with applying your plugin via an init script to get around this.
Sorry to revive that thread after so long, but I’ve been looking around for a way to use an includedBuild or even the default buildSrc in my settings.gradle file, and couldn’t find anything more recent
I’m just trying to use my boilerplate gradle code I use in pretty much every project and although the Project part works like a charm, the Settings part does not.
Are you aware of any progress on this topic ?
Indeed.
Either upgrade or downgrade Gradle.
Up to 6.0 you were able to use buildSrc classes in the settings script.
From 7.0 on you are able to includeBuild within pluginManagement in the settings script to include a build that contributes Gradle plugins including settings plugins: Gradle User Manual: Version 7.0
After comparing this to my setup, I was missing the java-gradle-plugin, which, theoretically is not required here (I had the right META-INF files), but it must do some magic when including builds. My guess is that it’s this extra gradlew outgoingVariant that only shows up with the plugin:
adds some validation for the descriptor files to the jar task
adds some tasks and configurations for proper TestKit usage
configures the publishing if either of the publishing plugins is applied
adds generation of the descriptor files
adds a task for plugin validation like missing input and output annotations and so on
adds the Gradle version as attribute to the compileClasspath and runtimeClasspath configurations so that multi-version plugins can properly resolve
The first point, applying the java-library plugin, adds the secondary variant you showed.
Though I don’t think that variant should influence whether you can use it in a composite build.