本地文件批量上传
通过本指南可以将本地的maven相关文件批量推送到阿里云仓库。
步骤一:下载迁移工具
通过上面地址将jar包下载到本地,保存为artifact-migration-jar-with-dependencies.jar。
步骤二:运行下载工具
请确保机器上安装了java8及以上版本,在当前jar包的目录下执行如下命令: 运行命令:java -jar artifact-migration-jar-with-dependencies.jar migrate --help 可以查看帮助信息。
用例说明
java -jar ./target/artifact-migration-jar-with-dependencies.jar migrate --help
Usage: migrate migrate [-hV] [--dryrun] [--exclude=<exclude>]
[--include=<include>] --source-dir=<sourceDir>
--target-repo-password=<repoPassword>
--target-repo-url=<repoUrl>
--target-repo-username=<repoUsername>
迁移制品
--dryrun 试运行,不会真正上传包
--exclude=<exclude> 排除的groupId,多个groupId以逗号分割
-h, --help Show this help message and exit.
--include=<include> 包含的groupId,多个groupId以逗号分割
--source-dir=<sourceDir>
源文件目录,比如~/.m2/repository
--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 migrate --source-dir="/root/.m2/repository" --target-repo-url="https://packages.aliyun.com/6927b116e6c3e0425dbdf60d/maven/2624322-release-6f6h6r" --target-repo-username="6927b0d679784350ec7aad16" --target-repo-password="************" --include="com.taobao.text" --exclude="junit"这条命令会将本地maven仓库中groupId为com.taobao.text下的所有包上传到当前仓库中。
作者:Jeebiz 创建时间:2025-12-01 10:57
最后编辑:Jeebiz 更新时间:2025-12-11 13:19
最后编辑:Jeebiz 更新时间:2025-12-11 13:19