简体   繁体   English

GitLab Runner 在 GitLab 注册表中找不到父 POM

[英]GitLab Runner cannot find parent POM in GitLab Registry

I want a GitLab Runner to build a Java/Maven project.我想要一个 GitLab Runner 来构建一个 Java/Maven 项目。 My problem is that Maven can't find the parent POM in the GitLab Registry inside the GitLab Runner, but locally it can.我的问题是 Maven 在 GitLab Runner 内的 GitLab Registry 中找不到父 POM,但在本地可以。

Running ./mwn install locally builds it.在本地运行./mwn install会构建它。 But the runner can't.但是跑步者不能。
Locally I have setup the ~/.m2/settings.xml , do I need to do it in the runner too?在本地我已经设置了~/.m2/settings.xml ,我也需要在跑步者中进行吗?

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>some-project-lib-common</artifactId>
    <version>0.0.3-SNAPSHOT</version>
    <name>some-project-lib-common</name>
    <description>some-project-lib-common</description>

    <parent>
        <groupId>com.some-project</groupId>
        <artifactId>some-project-maven-parent</artifactId>
        <version>0.0.16</version>
    </parent>


    <repositories>
        <repository>
            <id>gitlab-maven</id>
            <url>https://my.gitlab.instance.com/api/v4/groups/11/-/packages/maven</url>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>gitlab-maven</id>
            <url>https://my.gitlab.instance.com/api/v4/projects/21/packages/maven</url>
        </repository>
        <snapshotRepository>
            <id>gitlab-maven</id>
            <url>https://my.gitlab.instance.com/api/v4/projects/21/packages/maven</url>
        </snapshotRepository>
    </distributionManagement>

</project>

The runner produces this error message then:然后,跑步者会产生此错误消息:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.some-project:some-project-lib-common:0.0.3-SNAPSHOT: Could not find artifact com.some-project:some-project-maven-parent:pom:0.0.16 in gitlab-maven (https://my.gitlab.instance.com/api/v4/groups/11/-/packages/maven) and 'parent.relativePath' points at wrong local POM @ line 11, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.some-project:some-project-lib-common:0.0.3-SNAPSHOT (/builds/some-project/apps/some-project-lib-common/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.some-project:some-project-lib-common:0.0.3-SNAPSHOT: Could not find artifact com.some-project:some-project-maven-parent:pom:0.0.16 in gitlab-maven (https://my.gitlab.instance.com/api/v4/groups/11/-/packages/maven) and 'parent.relativePath' points at wrong local POM @ line 11, column 13 -> [Help 2]

What did I do wrong?我做错了什么?

Thank you in advance!先感谢您!

I did not know that I need to create a settings.xml such that the runner can actually connect/authenticate against the gitlab registry.我不知道我需要创建一个settings.xml以便运行者可以实际连接/验证 gitlab 注册表。

See the docs here for more: https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd有关更多信息,请参阅此处的文档: https ://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM