自动从依赖项添加存储库

时间:2020-07-29 12:56:14

标签: android gradle android-gradle-plugin

我有一个依赖项需要自定义存储库的库

dependencies {
    implementation 'com.chartboost:chartboost-sdk:8.1.0'
}

repositories {
    mavenCentral()
    maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}

这很好,但是它迫使我向使用该库的每个项目添加 maven { url "https://chartboostmobile.bintray.com/Chartboost" }。我想知道,有没有一种方法可以修改我自己的库,因此不需要为该依赖项添加自定义Maven存储库?可以将库中的所有存储库添加到项目中的东西。我尝试将implementationapi切换为无效

1 个答案:

答案 0 :(得分:0)

您可以将存储库放入[USER_HOME]/gradle/init.gradle文件中

allprojects {
  repositories {
    mavenCentral()
    maven { url "https://chartboostmobile.bintray.com/Chartboost" }     
  }
}

然后将它们应用于所有项目