Gradle arrangement position of Ali cloud storage and local warehouse

Download and install without introduction.

After the installation is complete, set the system variable path for the bin, New System Variable GRADLE_USER_HOME value gradle installation directory, or just find yourself a catalog will do.

Init.gradle new file in this directory, as follows:

allprojects {
    repositories {
        def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
        all { ArtifactRepository repo ->
            def url = repo.url.toString()
            if ((repo instanceof MavenArtifactRepository) && (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
        }
    }
}

jar package download after Ali will use cloud storage, local library GRADLE_USER_HOME \ caches \ modules-2 \ files-2.1

Guess you like

Origin www.cnblogs.com/duanyu1106/p/11141701.html