阿里云私有制品仓库密钥配置

说明

阿里云托管的私有 mirror 的 packages 共有两种, 一种是 maven 仓库, 一种是 npm 仓库.

此仓库的源代码位于 https://github.com/Jansora/packages

如果你需要下载阿里云私有 mirror 的 package, 你需要进行如下的配置

MAVEN 仓库

源代码位于 https://github.com/Jansora/packages/tree/master/maven

MAVEN 配置

请使用此settings.xml 文件

settings.xml
<?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 install

Gradle 配置

请在build.gradle中设置仓库的访问凭证。

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 仓库

源代码位于 https://github.com/Jansora/packages/tree/master/maven

npm

通过本指南快速设置仓库凭证,并完成制品文件的拉取。

步骤一:设置仓库凭证

设置云效仓库 npm-registrynpm 默认仓库,云效 npm-registry 会默认将淘宝镜像(cnpm:http://registry.npmmirror.com/)设置为代理仓库

npm config set registry=https://packages.aliyun.com/5fc730ae818169bd3b4d29c5/npm/npm-registry/

登陆 npm 仓库并设置凭证。

npm login

输入以下用户名、密码和邮箱,邮箱可以填写任意符合格式的邮箱地址。
为了您的仓库安全,用户名和密码已经隐藏。您可点击右上角直接复制,或者去除隐藏后手动复制。

用户名: 61a0376ad6190210d81020c0
密码: jyt5cGZ[DcjC

步骤二:拉取

进入你的工程目录,执行以下指令完成拉取。

npm install [package]

Yarn

通过本指南快速设置仓库凭证,并完成制品文件的拉取。

步骤一:设置仓库凭证

设置云效仓库 npm-registrynpm 默认仓库,云效 npm-registry 会默认将淘宝镜像(cnpm:http://registry.npmmirror.com/)设置为代理仓库。 由于拉取包时yarn需要使用npm配置中的认证信息,所以需要同时设置yarnnpm

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 仓库并设置凭证。

yarn login 
npm login

输入以下用户名和邮箱,邮箱可以填写任意符合格式的邮箱地址。
为了您的仓库安全,用户名和密码已经隐藏。您可点击右上角直接复制,或者去除隐藏后手动复制。

用户名: 61a0376ad6190210d81020c0
密码: jyt5cGZ[DcjC

yarn login命令不会要求用户输入密码。yarn在执行推送和拉取操作时需要获取npm配置中的认证信息。

步骤二:拉取

进入你的工程目录,执行以下指令完成拉取。

yarn add [package]

评论栏