Gradle、Maven使用阿里镜像源

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

allprojects {
    repositories {

        mavenLocal()

        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://maven.aliyun.com/repository/spring/'}
    	maven { url 'https://maven.aliyun.com/repository/google/'}
    	maven { url 'https://maven.aliyun.com/repository/gradle-plugin/'}
    	maven { url 'https://maven.aliyun.com/repository/spring-plugin/'}
    	maven { url 'https://maven.aliyun.com/repository/grails-core/'}
	    maven { url 'https://maven.aliyun.com/repository/apache-snapshots/'}
        
        mavenCentral()
    }
}

Maven配置阿里源

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

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

  <mirrors>

	<mirror>
		<id>aliyun-public</id>
		<mirrorOf>*</mirrorOf>
		<name>aliyun public</name>
		<url>https://maven.aliyun.com/repository/public</url>
	</mirror>

  </mirrors>
	<profile>
      <repositories>
        <repository>
            <id>google</id>
            <url>https://maven.aliyun.com/repository/google</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>gradle-plugin</id>
            <url>https://maven.aliyun.com/repository/gradle-plugin</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>spring</id>
            <url>https://maven.aliyun.com/repository/spring</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>spring-plugin</id>
            <url>https://maven.aliyun.com/repository/spring-plugin</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>grails-core</id>
            <url>https://maven.aliyun.com/repository/grails-core</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>


      </repositories>
    </profile>

参考文档:https://help.aliyun.com/document_detail/131465.html

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页