2019-07-24 15:25:34 星期三
Nexus是maven的私有仓库;
如果没有nexus,项目的打包都需要在公网下载,不利于包的管理和共用;
如果没有私有仓库,我们所需要的所有构件都需要通过maven的中央仓库和第三方的maven仓库下载到本地,而一个团队的所有人都需要重复地从maven仓库中下载构件。
Nexus默认配置中是在官网的中央仓库和第三方的maven仓库进行下载,速度偏慢
配置Nexus
左侧--Views/Repositories--Repositories--Add--Proxy Repository
填写:
Repository ID: aliyun
Repository Name: Aliyun Repository
Remote Storage Location: http://maven.aliyun.com/nexus/content/groups/public/
Save
把aliyun添加到仓库组中,记得把aliyun排在central上边。
刷新网页
选中仓库组Public Repositories
把Aliyun Repository从Availiable Repositories中拖到Ordered Group Repositories中,放在Central上边。这里列两个仓库地址:
仓库名称:central
代理源地址:https://repo1.maven.org/maven2/
使用地址
https://maven.aliyun.com/repository/central 或
https://maven.aliyun.com/nexus/content/repositories/central
仓库名称:public
代理源地址: central仓和jcenter仓的聚合仓
使用地址
https://maven.aliyun.com/repository/public 或
https://maven.aliyun.com/nexus/content/groups/public【FAQ】新版maven.aliyun.com答疑
Q: 为什么访问maven.aliyun.com/nexus/content/groups/public会返回404错误页面?
A:新版maven.aliyun.com还不支持通过这种方式浏览仓库,但是并不影响正常的构建下载。如果想浏览仓库内容请访问maven.aliyun.com/mvn/view页面,点击对应的仓库进行树状结构浏览。
Q:为什么首页显示的仓库地址变了,比如public仓的地址为https://maven.aliyun.com/repository/public?
A:首页上显示的仓库地址为推荐使用的仓库地址。为了保证兼容性也也支持以前的仓库地址,用户仍然可以通过http://maven.aliyun.com/nexus/content/groups/public来使用服务。