wpcnblog

本文转载自:https://www.cnblogs.com/yoyotl/p/6291703.html

感谢阿里云!

找到gradle的配置文件路径,例如Windows中的路径为C:\Users\${你的用户名}\.gradle

新建一个文件名为init.gradle,用记事本或者类似的编辑器打开,输入以下内容:

allprojects{
  repositories {
    def REPOSITORY_URL = \'http://maven.aliyun.com/nexus/content/groups/public/\'
      all { ArtifactRepository repo ->
        if(repo instanceof MavenArtifactRepository){
          def url = repo.url.toString()
          if (url.startsWith(\'https://repo1.maven.org/maven2\') || url.startsWith(\'https://jcenter.bintray.com/\')) {
            project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
            remove repo
          }
       }
    }
    maven {
      url REPOSITORY_URL
    }
  }
}

再执行gradle build的时候,你能看到下载地址切换到阿里云了,终于不用漫长的等待了。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
相关资源
相似解决方案