Applying a plugin to all settings

(Tilo Dickopp) #1

Is there a way to apply a ‘Plugin<Settings>’ to all settings files?

I’m looking for something to put in my ‘init.d’ directory which would be equivalent to this:

allprojects { project ->

project.buildscript {

repositories.maven { url ‘’ }

dependencies.classpath ‘org.example:my-plugin:1.0.0’



I know that the the ‘Gradle’ interface doesn’t have an ‘allsettings’ method, but was wondering if there is some kind of hack that anyone has used to achieve this?

(Peter Niederwieser) #2

What are you trying to achieve? There is only one settings file per build.

(Tilo Dickopp) #3

Thank you or your quick reply, Peter! Your statement: “There is only one settings file per build.”, helped me a lot to understand how you envision Gradle to be used. In line with that my question would have better been phrased:

Is there a way to apply a ‘Plugin<Settings>’ from a script in ‘init.d’?

I wrote a plugin that converts our internal project ID to a ‘ProjectDescriptor’ and want to use that plugin in all our builds. This way it would be easier to maintain all ‘settings.gradle’ files - there are 30+ builds.

Every build creates a deliverable for a certain customer or multi-tenant environment and includes a different set of projects, for example

  • build_1 might include projects A, B, D * build_2 might include projects A, C, E, F * and so on

(Luke Daley) #4

The only current hook is:

The ‘Settings’ object is still mutable in this callback, but it is after the settings file has been loaded.

I’ve raised GRADLE-2929 as a request to add a hook to get a hold of the ‘Settings’ object before the settings file is executed.