天使漫步IT工作室天使漫步IT工作室

Gradle 中 repositories 配置多个仓库的URL


Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 110

Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/u11u.com/usr/themes/wq/functions.php on line 116

gradle可以引用很多仓库,android gradle给出的默认仓库为:jcenter,但是当咱们引入第三方库时可能需要到别的仓库中寻找,这个时候就需要配置多个仓库。

比如省事的配置办法是在buildscript方法外启动allprojects方法,示例如下:

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

//对所有的project都有效
allprojects {
    repositories {
        jcenter() //第一个仓库
        maven { url "https://jitpack.io" } //第二个仓库
        maven { url  "http://dl.bintray.com/piasy/maven" } //第三个仓库
    }
}

本站原创,欢迎转载,转载敬请标明出处:天使漫步IT工作室 » Gradle 中 repositories 配置多个仓库的URL
添加新评论


Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /www/wwwroot/u11u.com/usr/themes/wq/comments.php on line 38