说明
阿里云托管的私有 mirror 的 packages 共有两种, 一种是 maven 仓库, 一种是 npm 仓库.
如果你需要下载阿里云私有 mirror 的 package, 你需要进行如下的配置
MAVEN 仓库
MAVEN 配置
请使用此
settings.xml 文件settings.xmlHTML / XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>mirror</id>
<mirrorOf>central,jcenter,!rdc-releases,!rdc-snapshots</mirrorOf>
<name>mirror</name>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<servers>
<server>
<id>rdc-releases</id>
<username>61a0376ad6190210d81020c0</username>
<password>jyt5cGZ[DcjC</password>
</server>
<server>
<id>rdc-snapshots</id>
<username>61a0376ad6190210d81020c0</username>
<password>jyt5cGZ[DcjC</password>
</server>
</servers>
<profiles>
<profile>
<id>rdc</id>
<properties>
<altReleaseDeploymentRepository>
rdc-releases::default::https://packages.aliyun.com/maven/repository/2054722-release-rg7DwN/
</altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository>
rdc-snapshots::default::https://packages.aliyun.com/maven/repository/2054722-snapshot-GDKyLs/
</altSnapshotDeploymentRepository>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-releases</id>
<url>https://packages.aliyun.com/maven/repository/2054722-release-rg7DwN/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-snapshots</id>
<url>https://packages.aliyun.com/maven/repository/2054722-snapshot-GDKyLs/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-releases</id>
<url>https://packages.aliyun.com/maven/repository/2054722-release-rg7DwN/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-snapshots</id>
<url>https://packages.aliyun.com/maven/repository/2054722-snapshot-GDKyLs/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>rdc</activeProfile>
</activeProfiles>
</settings>安装依赖
将上述文件指定为
/tmp/settings-aliyun.xml通过此命令安装
mvn --settings /tmp/settings-aliyun.xml clean installGradle 配置
请在
build.gradle中设置仓库的访问凭证。Bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
allprojects {
repositories {
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
credentials {
username '61a0376ad6190210d81020c0'
password 'jyt5cGZ[DcjC'
}
url 'https://packages.aliyun.com/maven/repository/2054722-release-rg7DwN/'
}
maven {
credentials {
username '61a0376ad6190210d81020c0'
password 'jyt5cGZ[DcjC'
}
url 'https://packages.aliyun.com/maven/repository/2054722-snapshot-GDKyLs/'
}
}
}NPM 仓库
npm
通过本指南快速设置仓库凭证,并完成制品文件的拉取。
步骤一:设置仓库凭证
设置云效仓库
npm-registry 为 npm 默认仓库,云效 npm-registry 会默认将淘宝镜像(cnpm:http://registry.npmmirror.com/)设置为代理仓库Bash
1
npm config set registry=https://packages.aliyun.com/5fc730ae818169bd3b4d29c5/npm/npm-registry/登陆
npm 仓库并设置凭证。纯文本
1
npm login输入以下用户名、密码和邮箱,邮箱可以填写任意符合格式的邮箱地址。
为了您的仓库安全,用户名和密码已经隐藏。您可点击右上角直接复制,或者去除隐藏后手动复制。
纯文本
1
2
用户名: 61a0376ad6190210d81020c0
密码: jyt5cGZ[DcjC步骤二:拉取
进入你的工程目录,执行以下指令完成拉取。
Bash
1
npm install [package]Yarn
通过本指南快速设置仓库凭证,并完成制品文件的拉取。
步骤一:设置仓库凭证
设置云效仓库
npm-registry 为 npm 默认仓库,云效 npm-registry 会默认将淘宝镜像(cnpm:http://registry.npmmirror.com/)设置为代理仓库。 由于拉取包时yarn需要使用npm配置中的认证信息,所以需要同时设置yarn和npm。Bash
1
2
3
yarn config set registry https://packages.aliyun.com/5fc730ae818169bd3b4d29c5/npm/npm-registry/
npm config set registry=https://packages.aliyun.com/5fc730ae818169bd3b4d29c5/npm/npm-registry/
npm config set always-auth true登录 npm 仓库并设置凭证。
纯文本
1
2
yarn login
npm login输入以下用户名和邮箱,邮箱可以填写任意符合格式的邮箱地址。
为了您的仓库安全,用户名和密码已经隐藏。您可点击右上角直接复制,或者去除隐藏后手动复制。
纯文本
1
2
用户名: 61a0376ad6190210d81020c0
密码: jyt5cGZ[DcjCyarn login命令不会要求用户输入密码。yarn在执行推送和拉取操作时需要获取npm配置中的认证信息。步骤二:拉取
进入你的工程目录,执行以下指令完成拉取。
纯文本
1
yarn add [package]
评论栏
分享你的想法,或参与下面的讨论。
参与讨论
支持 Markdown、代码和图片
友善交流,让讨论更有价值。
更多留言
加载中…