本文介绍如何将其他NPM仓库中的制品包同步到云效的NPM私库中。
操作步骤
云效支持两种方式将NPM私库中的制品包迁移到云效的NPM私库中,您可以根据实际需求进行选择:
从Nexus3导入制品。
从其他npm制品源导入制品。
步骤一:下载迁移工具
通过上面地址将jar包下载到本地,保存为artifact-migration-jar-with-dependencies.jar。
步骤二:运行下载工具
请确保机器上安装了Java8及以上版本,在当前jar包的目录下执行如下命令: 运行命令:java -jar artifact-migration-jar-with-dependencies.jar migrateNexusNpm --help
可以查看帮助信息。
java -jar artifact-migration-jar-with-dependencies.jar migrateNexusNpm --help
Usage: migrate migrateNexusNpm [-hV] [--dryrun] [--exclude=<exclude>]
[--include=<include>] --nexus-host=<nexusHost>
--source-repo-id=<repoId>
--source-repo-password=<repoPassword>
--source-repo-username=<repoUsername>
--target-repo-password=<repoPassword>
--target-repo-url=<repoUrl>
--target-repo-username=<repoUsername>
迁移nexus3中的npm制品
--dryrun 试运行,不会真正上传包
--exclude=<exclude> 排除的包名,多个包名以逗号分割,模糊匹配
-h, --help Show this help message and exit.
--include=<include> 包含的包名,多个包名以逗号分割,模糊匹配
--nexus-host=<nexusHost>
nexus服务器地址
--source-repo-id=<repoId>
源仓库Id
--source-repo-password=<repoPassword>
访问源仓库的密码
--source-repo-username=<repoUsername>
访问源仓库的用户名
--target-repo-password=<repoPassword>
访问目标仓库的密码,可在packages.aliyun.com中仓库指
南中查看
--target-repo-url=<repoUrl>
目标仓库地址,可在packages.aliyun.com中仓库指南中查
看
--target-repo-username=<repoUsername>
访问目标仓库的用户名,可在packages.aliyun.com中仓库
指南中查看
-V, --version Print version information and exit.
如果帮助信息中中文出现乱码,可先在命令行中执行 chcp 65001
,然后再执行java命令。
示例命令:
java -jar artifact-migration-jar-with-dependencies.jar migrateNexusNpm --source-repo-id="my-npm-repo" --source-repo-username="admin" --source-repo-password="admin123" --nexus-host="http://localhost:8081" --target-repo-url="https://packages.aliyun.com/66b3075ffaba0e0aab301c38/npm/repo-yhqkr/" --target-repo-username="66b32fbfbecc937b9f798388" --target-repo-password="IYNrp4F[ck6[" --include="@taobao"
这条命令会将指定的Nexus仓库my-npm-repo中包名包含@taobao的所有包上传到当前仓库中。具体参数信息,可在制品仓库主页面,选择进入目标制品仓库,在
中获取:请确保机器上安装了Java8及以上版本,在当前jar包的目录下执行如下命令: 运行命令:java -jar artifact-migration-jar-with-dependencies.jar migrateNpm --help
可以查看帮助信息。
java -jar artifact-migration-jar-with-dependencies.jar migrateNpm --help
Usage: migrate migrateNpm [-hV] [--dryrun] --package-list=<packageList>
--source-repo-password=<sourceRepoPassword>
--source-repo-url=<sourceRepoUrl>
--source-repo-username=<sourceRepoUsername>
--target-repo-password=<repoPassword>
--target-repo-url=<repoUrl>
--target-repo-username=<repoUsername>
将一个npm源中的制品迁移到packages,需要用户提供迁移的包名列表
--dryrun 试运行,不会真正上传包
-h, --help Show this help message and exit.
--package-list=<packageList>
需要迁移的包名列表,以逗号分割
--source-repo-password=<sourceRepoPassword>
访问源仓库的密码
--source-repo-url=<sourceRepoUrl>
源仓库的url地址
--source-repo-username=<sourceRepoUsername>
访问源仓库的用户名
--target-repo-password=<repoPassword>
访问目标仓库的密码,可在packages.aliyun.com中仓库指南中
查看
--target-repo-url=<repoUrl>
目标仓库地址,可在packages.aliyun.com中仓库指南中查看
--target-repo-username=<repoUsername>
访问目标仓库的用户名,可在packages.aliyun.com中仓库指南
中查看
-V, --version Print version information and exit.
如果帮助信息中中文出现乱码,可先在命令行中执行 chcp 65001
,然后再执行java命令。
示例命令:
java -jar artifact-migration-jar-with-dependencies.jar migrateNpm --source-repo-url="http://127.0.0.1:8081/repository/mynpm" --source-repo-username="admin" --source-repo-password="admin123" --target-repo-url="https://packages.aliyun.com/66b3075ffaba0e0aab301c38/npm/repo-yhqkr/" --target-repo-username="66b32fbfbecc937b9f798388" --target-repo-password="IYNrp4F[ck6[" --package-list=my-package,@bowen/expressjs-hello"
这条命令会将http://127.0.0.1:8081/repository/mynpm仓库中包名为@bowen/expressjs-hello和my-package的所有版本传到当前仓库中。具体参数信息,可在制品仓库主页面,选择进入目标制品仓库,在
中获取:步骤三:查看运行结果
出现migration is finished字样表示迁移已完成,即可在云效目标制品仓库中查看:
- 本页导读 (1)
- 操作步骤
- 步骤一:下载迁移工具
- 步骤二:运行下载工具
- 步骤三:查看运行结果