最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - An error occurs during the execution of the GitLab Pipeline: "Could not find artifact..." - Stack Overf

programmeradmin2浏览0评论

I use the GitLab Pipeline to work on the project. The pipeline has a test stage.
In the test stage, there is a job called unit_test.
The following error occurs during the execution of a job called unit_test:

Failed to execute goal on project backend: Could not resolve dependencies for project <my_package>:backend:jar:1.0.0-SNAPSHOT: Could not find artifact <my_package>:minio-service-spring-boot-starter:jar:1.0.0 in gitlab-maven (...) -> [Help 1]

I have this artifact in the GitLab Package Registry. The artifact has been successfully uploaded and has version 1.0.0.
I use Maven to build the project.
The file pom.xml:


  <dependencies>
//...
  <!-- MinIO Service Starter -->
        <dependency>
            <groupId>net.project.crm</groupId>
            <artifactId>minio-service-spring-boot-starter</artifactId>
            <version>${minio-service-starter.version}</version>
        </dependency>
    </dependencies>

 <!-- GitLab Package Registry -->
    <repositories>
        <repository>
            <id>gitlab-maven</id>
            <url>;/url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>gitlab-maven</id>
            <url>;/url>
        </repository>

        <snapshotRepository>
            <id>gitlab-maven</id>
            <url>;/url>
        </snapshotRepository>
    </distributionManagement>

There is a file in the root of the project ci-settings.xml:

<settings xmlns=".2.0"
          xmlns:xsi=";
          xsi:schemaLocation=".2.0
          .2.0.xsd">
    <servers>
        <server>
            <id>gitlab-maven</id>
            <username>gitlab-ci-token</username>
            <password>${CI_JOB_TOKEN}</password>
        </server>
    </servers>

</settings>

The job of the pipeline where the error occurs:

unit_test:
  stage: test
  image:
    name: maven:3.8-openjdk-17-slim
  artifacts:
    paths:
      - target/surefire-reports/
    reports:
      junit: target/surefire-reports/*.xml
    expire_in: 2 days
  cache:
    key: "maven-repo"
    paths:
      - .m2/repository/
    policy: pull-push
  script:
    - mvn -P!checkstyle clean test --settings=ci-settings.xml
  rules:
    - if: $CI_COMMIT_REF_PROTECTED == 'false'

Please help me fix the problem.
If you need anymore information to solve the problem, then I am ready to share it with you.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论