1

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

 1 year ago
source link: https://www.jansora.com/notebook/107578
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

MAVEN 仓库

MAVEN 配置

请使用此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>

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

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

步骤一:设置仓库凭证

设置云效仓库 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]

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

步骤一:设置仓库凭证

设置云效仓库 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]

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK