Я пытаюсь настроить репозитории для всех подпроектов.
У меня есть основной build.gradle
:
buildscript {
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
...
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'base'
}
allprojects {
apply plugin: 'base'
repositories {
mavenLocal()
mavenCentral()
google()
jcentre()
...
}
wrapper{
gradleVersion = '6.5.1'
distributionType = Wrapper.DistributionType.ALL
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
В подпроектах build.gradle
у меня просто:
...
dependencies {
implementation ....
}
Я получаю:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Cannot resolve external dependency .... because no repositories are defined.
Required by:
project :
Я хочу определить repositories
один раз в основном файле, поскольку они не меняются в подпроектах.
В settings.gradle
основного проекта у меня есть:
rootProject.name = 'main-project-name'
include 'sub-project-name'
А в settings.gradle
подпроекта у меня есть:
rootProject.name = 'sub-project-name'