repo.spring.io lazily caches the contents of Maven Central. You don't say which dependency it is that's causing a problem, but I believe the problem that you're seeing is that you're attempting to access an artifact that has yet to be cached. This will result in a 401 response.
Trying adding mavenCentral()
to the configured repositories in build.gradle
. For example:
repositories {
mavenCentral()
maven { url "https://repo.spring.io/milestone" }
}