从JFrog Artifactory导入制品

通过本指南可以将JFrog Artifactory仓库中的制品包批量推送到阿里云packages仓库。

步骤一:下载迁移工具

工具下载地址:https://agent-install-beijing.oss-cn-beijing.aliyuncs.com/artifact-migration-0.0.2-jar-with-dependencies.jar

通过上面地址将jar包下载到本地,保存为artifact-migration-jar-with-dependencies.jar。

步骤二:运行下载工具

请确保机器上安装了java8及以上版本,在当前jar包的目录下执行如下命令: 运行命令:java -jar artifact-migration-jar-with-dependencies.jar migrateArtifactory --help 可以查看帮助信息。

用例说明

java -jar artifact-migration-jar-with-dependencies.jar migrateArtifactory --help
Usage: migrate migrateArtifactory [-hV] [--dryrun]
                                  --artifactory-host=<artifactoryHost>
                                  [--exclude=<exclude>] [--include=<include>]
                                  --source-repo-id=<repoId>
                                  --source-repo-password=<repoPassword>
                                  --source-repo-username=<repoUsername>
                                  --target-repo-password=<repoPassword>
                                  --target-repo-url=<repoUrl>
                                  --target-repo-username=<repoUsername>
                                  [@<filename>...]
迁移JFrog Artifactory中的maven制品
      [@<filename>...]      One or more argument files containing options.
      --artifactory-host=<artifactoryHost>
                            artifactory源服务器地址,如http://127.0.0.1:
                              8081/artifactory
      --dryrun              试运行,不会真正上传包
      --exclude=<exclude>   排除的groupId,多个groupId以逗号分割,支持前缀匹配
  -h, --help                Show this help message and exit.
      --include=<include>   包含的groupId,多个groupId以逗号分割,支持前缀匹配
      --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  migrateArtifactory --source-repo-id="maven-releases" --source-repo-username="admin" --source-repo-password="admin123" --artifactory-host="http://localhost:8081/artifactory" --target-repo-url="https://packages.aliyun.com/6927b116e6c3e0425dbdf60d/maven/2624322-release-6f6h6r"  --target-repo-username="6927b0d679784350ec7aad16" --target-repo-password="************" --include="com.taobao.text"

这条命令会将指定的Artifactory仓库中maven-releases中groupId为com.taobao.text下的所有包上传到当前仓库中。

作者:Jeebiz  创建时间:2025-12-01 10:59
最后编辑:Jeebiz  更新时间:2025-12-11 13:19