Gradle配置

配置远程仓库

在gradle目录下的init.d目录中创建名为init.gradle文件,内容如下:

allprojects{
    repositories {
        def REPOSITORY_URL = 'http://localhost:8081/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_USER_HOME
D:\software\gradle-repository

提高编译速度

在gradle仓库.gradle目录下创建一个gradle.properties 文件,在其中添加如下语句:

org.gradle.daemon=true

posted @ 2019-02-20 18:06  甜咖啡06  阅读(172)  评论(0编辑  收藏  举报