從 Maven 轉(zhuǎn)到 Gradle
在項目根目錄下運行 gradle init
即可直接轉(zhuǎn)換成 Gradle 項目藕甩,工程和子模塊下會有 build.gradle 等文件
設(shè)置國內(nèi)鏡像
編輯 ~/.gradle/init.gradle
(Windows 路徑:%HomePath%\.gradle\init.gradle
):
allprojects{
repositories {
def REPOSITORY_URL = 'http://maven.aliyun.com/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
}
}
}