what's the difference in definning repositories between top level's build.grad and settings.gradle

Viewed 22

when i upgrade android gradle plugin to 7.x, i have the repositories block defining in settings.gradle, they look like this:

settings.gradle

pluginManagement {

    plugins {
        id 'com.android.application' version '7.2.2' apply false
        id 'com.android.library' version '7.2.2' apply false
    }

    repositories {
        maven {
           //xxx custom repo
        }
    }
}

top level's build.gradle

buildscript {

    repositories {
        maven {
            //custom repo
        }
    }
}

According to the official documentation, gradle will use the repositories(defined in buildScript block) to look for plugins. So what's the difference between them? When i merge buildScript.repositories block and pluginManagement.repositories block, gradle reports an error:

A problem occurred configuring root project 'xxx'.
> Could not resolve all files for configuration ':classpath'.
   > Cannot resolve external dependency xxx:xxx:1.0.2 because no repositories are defined.
     Required by:
         project :
   > Cannot resolve external dependency xxx:xxx:1.5.4 because no repositories are defined.
     Required by:
         project :
   > Cannot resolve external dependency xxx:xxx:2.2.1 because no repositories are defined.
     Required by:
         project :
   > Cannot resolve external dependency xxx:1.0.5 because no repositories are defined.
     Required by:
         project :
0 Answers
Related