Plugin not found without additional repository settings in settings.gradle

Hi,
using Gradle 5.1
Want to use the Sonarqube gradle plugin in my build.
With this init.gradle

File nexusPropertiesFile = file('file://Y:/config/nexus/gradle.properties');

if (nexusPropertiesFile.exists()) {
Properties nexusProperties = new Properties();
nexusProperties.load(nexusPropertiesFile.newInputStream());
allprojects {
nexusProperties.each {
if (!ext.has(it.key)) {
ext.set(it.key, it.value);
}
}
}
}

allprojects {
if (ext.has(‘nexus.username’) && ext.has(‘nexus.passwd’) && ext.has(‘nexus.url’)) {
ext.RepoConfigurator = {
maven {
credentials {
username project.ext[‘nexus.username’]
password project.ext[‘nexus.passwd’]
}
url project.ext[‘nexus.url’]
}
}
buildscript.repositories RepoConfigurator
repositories RepoConfigurator
repositories.each{ println 'Init Repository: ’ + it.url}

  if (gradle.gradleVersion =~ /5.+/) {
settingsEvaluated { settings ->
      settings.pluginManagement {
  	  repositories {
  	    maven {
  		  credentials {
  		    username project.ext['nexus.username']
  			password project.ext['nexus.passwd']
  		  }
  		url project.ext['nexus.url']
  	    } 
        }
      }
    }
  repositories.each{ println 'Init Plugin Repository for Gradle 5.x : ' + it.url}
  }

}
}

and this settings.gradle

rootProject.name = 'foobar'

i get this error

What went wrong:
Plugin [id: 'org.sonarqube', version: '2.6.2'] was not found in any of the following sources:

Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'org.sonarqube:org.sonarqube.gradle.plugin:2.6.2')
  Searched in the following repositories:
    Gradle Central Plugin Repository

Whereas with this settings.gradle

pluginManagement {
repositories {
maven {
url “http://nexus/content/groups/public/
credentials {
username ’ … ’
password ’ … ’
}
}
}
}

rootProject.name = ‘foobar’

the build works fine.
How to get rid of that additional pluginManangement section with credentials in settings.gradle ?

Regards,
Gilbert

OK, works with this additional entry in settings.gradle

pluginManagement {
repositories {
maven {
url “https://nexus/content/groups/public/
}
}
}

This has to be the first entry.