来自私有包注册表的 Gitlab CI/CD Maven 依赖项:找不到工件

时间:2021-01-21 18:04:59

标签: maven gitlab-ci

社区。

我在属于某个组的项目中托管了一个 Maven 包注册表。 在该注册表中,我使用个人访问令牌手动上传了一个工件(pom 和 jar 文件)。

我有一个使用该包注册表中的工件的项目。因此,当我尝试执行 test 阶段时,它失败并显示以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:get (default-cli) on project docker_receiver: Couldn't download artifact: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact transparent_coach:maven_registry:jar:1.0.0 in gitlab-maven (https://gitlab.com/api/v4/projects/23241686/packages/maven)

这是我正在运行的测试阶段:

test:
  stage: test
  allow_failure: false
  tags:
    - docker
    - dind
  script:
    - mvn --version
    - echo "$TC_GITLAB_AUTH_SETTINGS" > settings.xml
    - mvn dependency:get -Dartifact=transparent_coach:maven_registry:1.0.0
    - mvn clean verify

存在 settings.xml 文件,它包含正确的结构,其结构与我用于将工件上传到注册表的个人令牌相同。 pom.xml 中注册表和工件的参数正确:

<dependency>
  <groupId>transparent_coach</groupId>
  <artifactId>maven_registry</artifactId>
  <version>1.0.0</version>
</dependency>

#----------------------

<repositories>
  <repository>
    <id>gitlab-maven</id>
    <url>https://gitlab.com/api/v4/projects/23241686/packages/maven</url>
  </repository>
</repositories>

<distributionManagement>
  <repository>
    <id>gitlab-maven</id>
    <url>https://gitlab.com/api/v4/projects/23241686/packages/maven</url>
  </repository>

  <snapshotRepository>
    <id>gitlab-maven</id>
    <url>https://gitlab.com/api/v4/projects/23241686/packages/maven</url>
  </snapshotRepository>
</distributionManagement>

我在这里做错了什么?

0 个答案:

没有答案