当前位置:   article > 正文

【gradle】gradle配置全局仓库_gradle仓库配置

gradle仓库配置

配置gradle仓库

1.在系统环境变量中配置

GRADLE_USER_HOME=D:\gradleRepository

2.在配置的路径中,增加文件init.gradle

  1. allprojects{
  2. repositories {
  3. def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
  4. def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
  5. all { ArtifactRepository repo ->
  6. if(repo instanceof MavenArtifactRepository){
  7. def url = repo.url.toString()
  8. if (url.startsWith('https://repo1.maven.org/maven2')) {
  9. project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
  10. remove repo
  11. }
  12. if (url.startsWith('https://jcenter.bintray.com/')) {
  13. project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
  14. remove repo
  15. }
  16. }
  17. }
  18. maven {
  19. url ALIYUN_REPOSITORY_URL
  20. url ALIYUN_JCENTER_URL
  21. }
  22. }
  23. }

参考文章

https://www.cnblogs.com/maobuji/p/11022023.html

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号