gradle编译spring
配置gralde
调整gradle的仓库使用阿里镜像,在.gradle下创建init.gradle,并输入以下内容:
allprojects {
repositories {
maven {
url 'https://maven.aliyun.com/repository/public/'
}
maven {
url 'https://maven.aliyun.com/repository/google/'
}
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://repo.maven.apache.org/maven2/') || url.startsWith('https://repo.maven.org/maven2')
|| url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')
|| url.startsWith('https://maven.google.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/')) {
//project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
remove repo
}
}
}
}
buildscript {
repositories {
maven{ url 'https://maven.aliyun.com/repository/public/'}
maven{ url 'https://maven.aliyun.com/repository/google/'}
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/')
|| url.startsWith('https://dl.google.com/dl/android/maven2/')) {
//project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
remove repo
}
}
}
}
}
}
,然后进行编译即可,无需修改spring项目中的配置。
本文地址:https://blog.csdn.net/yz7074998/article/details/107171269
上一篇: 只要工资-私房钱
下一篇: 那年晚自习课最是幽默小笑话