首页 > 编程知识 正文

maven 编译命令,maven下载jar包失败

时间:2023-05-05 05:29:48 阅读:149572 作者:1839

修改个别项目

在项目的build.gradle文件中,修改repositories配置

由:

资料档案库{

mavenCentral ()

maven { URL ' https://repo.spring.io/snapshot ' }

maven { URL ' https://repo.spring.io/milestone ' }

}

更改:

资料档案库{

maven { URL ' http://maven.a liyun.com/nexus/content/groups/public/' }

}

或:

资料档案库{

maven { URL ' http://maven.oschina.net/content/groups/public/' }

}

这样,就可以从国内镜像下载依存关系,从而大大提高速度

注意:

build.gradle文件中有两处repositories,都需要修改

AlibabaCloud (阿里巴巴云)的速度比较快,更稳定

更改所有项目

如果要一次更改所有仓库的地址,可以在C:Usershellowood.gradle和“. gradle”文件夹下添加并配置init.gradle文件

init.gradle

所有项目{

资料档案库{

def repository _ URL=' http://maven.a liyun.com/nexus/content/groups/public/'

全部{ artifact repository repo -

存储库(if ) {

def url=repo.url.toString (

URL.starts with (https://repo1. maven.org/maven2(|URL.starts with ) ) https://jcenter.bintray.com/' )

移除修复

}

}

}

7 {

URL资料档案库_ URL

}

}

}

这将允许您在编译项目时从蚂蚁仓库下载依赖项

init.build脚本可以查看https://docs.grad le.org/current/user guide/init _ scripts.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。