当前位置:   article > 正文

Gradle、Maven使用阿里镜像源_gradle镜像源

gradle镜像源

1.针对单个项目比较简单:

仓库服务https://developer.aliyun.com/mvn/guide

  1. repositories {
  2. maven {
  3. url 'https://maven.aliyun.com/repository/public/'
  4. }
  5. maven {
  6. url 'https://maven.aliyun.com/repository/spring/'
  7. }
  8. mavenLocal()
  9. mavenCentral()
  10. }

2.针对全局项目

在GRADLE_HOME/init.d/目录下新建文件:init.gradle

  1. allprojects {
  2. repositories {
  3. mavenLocal()
  4. maven { url 'https://maven.aliyun.com/repository/public/' }
  5. maven { url 'https://maven.aliyun.com/repository/spring/'}
  6. maven { url 'https://maven.aliyun.com/repository/google/'}
  7. maven { url 'https://maven.aliyun.com/repository/gradle-plugin/'}
  8. maven { url 'https://maven.aliyun.com/repository/spring-plugin/'}
  9. maven { url 'https://maven.aliyun.com/repository/grails-core/'}
  10. maven { url 'https://maven.aliyun.com/repository/apache-snapshots/'}
  11. mavenCentral()
  12. }
  13. }

Maven配置阿里源

【idea自带maven插件路径:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1\plugins\maven\lib\maven3\conf】

C:\Users\{USER}\.m2\settings.xml

  1. <mirrors>
  2. <mirror>
  3. <id>aliyun-public</id>
  4. <mirrorOf>*</mirrorOf>
  5. <name>aliyun public</name>
  6. <url>https://maven.aliyun.com/repository/public</url>
  7. </mirror>
  8. </mirrors>
  1. <profile>
  2. <repositories>
  3. <repository>
  4. <id>google</id>
  5. <url>https://maven.aliyun.com/repository/google</url>
  6. <releases>
  7. <enabled>true</enabled>
  8. </releases>
  9. <snapshots>
  10. <enabled>true</enabled>
  11. </snapshots>
  12. </repository>
  13. <repository>
  14. <id>gradle-plugin</id>
  15. <url>https://maven.aliyun.com/repository/gradle-plugin</url>
  16. <releases>
  17. <enabled>true</enabled>
  18. </releases>
  19. <snapshots>
  20. <enabled>true</enabled>
  21. </snapshots>
  22. </repository>
  23. <repository>
  24. <id>spring</id>
  25. <url>https://maven.aliyun.com/repository/spring</url>
  26. <releases>
  27. <enabled>true</enabled>
  28. </releases>
  29. <snapshots>
  30. <enabled>true</enabled>
  31. </snapshots>
  32. </repository>
  33. <repository>
  34. <id>spring-plugin</id>
  35. <url>https://maven.aliyun.com/repository/spring-plugin</url>
  36. <releases>
  37. <enabled>true</enabled>
  38. </releases>
  39. <snapshots>
  40. <enabled>true</enabled>
  41. </snapshots>
  42. </repository>
  43. <repository>
  44. <id>grails-core</id>
  45. <url>https://maven.aliyun.com/repository/grails-core</url>
  46. <releases>
  47. <enabled>true</enabled>
  48. </releases>
  49. <snapshots>
  50. <enabled>true</enabled>
  51. </snapshots>
  52. </repository>
  53. </repositories>
  54. </profile>

参考文档:公共代理库 - 云效(老版) - 阿里云

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/237498?site
推荐阅读
相关标签
  

闽ICP备14008679号