GRADLE_HOME/init.d/settings.gradle not treated as settings file

I have created the file:
With the following content:

pluginManagement {
  repositories {
      maven {
        url 'maven-repo'
      ivy {
        url 'ivy-repo'

Which is consistent with the documentation.

However, I get the following error message while trying to build a project:

Only Settings scripts can contain a pluginManagement {} block.

I have run a debugging session with Gradle, and found out that settings.gradle from the project is terated as the Settings file, whereas the settings.gradle from GRADLE_HOME/init.d is not (see org.gradle.configuration.DefaultScriptPluginFactory.ScriptPluginImpl#wrap).

Therefore my questions are:

  1. Is this a bug or am I doing something wrong?
  2. If this is a valid behavior, what is the other way of defining a global mirror for Gradle Plugins repository, outside of the project, in GRADLE_HOME/init.d? This is important since the sad fact is that I have to prepare an In-corporate Gradle package. :cry:

Files in the init.d directory are init scripts, not settings scripts. Their target is a Gradle instance, which has a settingsLoaded callback which allows you to modify the Settings object, including pluginManagement.