Why is Gradle still trying to download form 3rd party repo in spite of Nexus repo setup?

I have this in my build.gradle file

buildscript {
  repositories {
    maven {
      url "https://myNexusRepo.company.com"
      credentials {
        username "user"
        password "password"
      }
    }
  }
}

And I have a Proxy repo setup in my Nexus directory, like this

But yet I still get

$ ./gradlew clean
> Could not resolve all files for configuration ':MarcomLite:classpath'.
   > Could not download spring-boot-loader-tools.jar (org.springframework.boot:spring-boot-loader-tools:1.4.6.RELEASE)
      > Could not get resource 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.4.6.RELEASE/spring-boot-loader-tools-1.4.6.RELEASE.jar'.
         > Could not GET 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.4.6.RELEASE/spring-boot-loader-tools-1.4.6.RELEASE.jar'. Received status code 502 from server: Bad Gateway

That is, I’m still access external repo. What am I missing?

If you are applying plugins via the plugins block, then the repositories used to resolve those plugins is not controlled by the buildscript repositories. Instead, the repositories are configured via the pluginManagement block in settings.gradle

1 Like

Also, I just noticed that you did not place your maven call in the correct location. It should be in the buildscript.repositories block:

buildscript {
    repositories {
        maven {
            ...
        }
    }
}

Thanks @Chris_Dore, i updated my OP, and marked your previous reply as the answer.

@Chris_Dore I updated my settings.gradle file to include the pluginManagement {} block, but am getting

$ ./gradlew -v
------------------------------------------------------------
Gradle 3.4.1
------------------------------------------------------------

$ ./gradlew clean
A problem occurred evaluating settings "project"
> Could not find method pluginManagement() ...

I know it’s a very old Gradle version, but we’re stuck with it (per developers because of Spring Boot versions we use).

Ah for my Gradle version it’s

pluginRepositories {...}