Java Maven Nexus问题-403的授权失败

Java Maven Nexus问题-403的授权失败,java,maven,gitlab,nexus,gitlab-ci-runner,Java,Maven,Gitlab,Nexus,Gitlab Ci Runner,我们已经讨论这个问题好几天了 为从Maven和Nexus读取依赖项的Java应用程序创建了Gitlab CI管道 gitlab管道被配置为以具有管理员权限的nexus用户的身份运行,这一点已经过多次验证 但是,当执行gitlab管道时,我们会得到以下错误: [ERROR] Failed to execute goal on project hello-component: Could not resolve dependencies for project x.y.z:hello-compone

我们已经讨论这个问题好几天了

为从Maven和Nexus读取依赖项的Java应用程序创建了Gitlab CI管道

gitlab管道被配置为以具有管理员权限的nexus用户的身份运行,这一点已经过多次验证

但是,当执行gitlab管道时,我们会得到以下错误:

[ERROR] Failed to execute goal on project hello-component: Could not resolve dependencies for project x.y.z:hello-component:jar:1.6-SNAPSHOT: Failed to collect dependencies at a.b:c:jar:4.5.1132100: Failed to read artifact descriptor for b:c:jar:4.5.1132100: Could not transfer artifact a.b:c:pom:4.5.1132100 from/to maven-snapshots (http://host:8081/repository/maven-snapshots): Authorization failed for http://host:8081/repository/maven-snapshots/a/b/c/4.5.1132100/nidp-4.5.1132100.pom 403 Forbidden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project hello-component: Could not resolve dependencies for project x.y.z:hello-component:jar:1.6-SNAPSHOT: Failed to collect dependencies at a.b:c:jar:4.5.1132100
我还使用了以下指南:

https://blog.sonatype.com/how-to-use-gitlab-ci-with-nexus
My POM具有以下功能,在ci/cd/settings/variables中配置了环境变量:

     <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.5.1</version>
                    <executions>
                        <execution>
                            <id>default-deploy</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <serverId>maven-snapshots</serverId>
                        <nexusUrl>http://host:8081/repository/maven-snapshots</nexusUrl>
                        <skipStaging>true</skipStaging>
                    </configuration>
                </plugin>
            </plugins>
        </build>

<repositories>
        <repository>
            <id>maven-snapshots</id>
            <url>http://host:8081/repository/maven-snapshots</url>
        </repository>
        <repository>
            <id>maven-releases</id>
            <url>http://host:8081/repository/maven-releases</url>
        </repository>
        <!--repository>
            <id>nexus.local</id>
            <url>$HOME/.m2/repository</url>
        </repository-->
    </repositories>

    <distributionManagement>
        <snapshotRepository>
            <id>maven-snapshots</id>
            <url>http://host:8081/repository/maven-snapshots</url>
        </snapshotRepository>
        <repository>
            <id>maven-releases</id>
            <url>http://host:8081/repository/maven-releases</url>
        </repository>
    </distributionManagement>
gitlab ci服务器上的Setting.xml具有以下nexus用户引用:

maven快照 [管理员用户] [管理员密码]

任何帮助都将不胜感激

谢谢

image: maven:3.3.9-jdk-8

variables:
  GIT_STRATEGY: clone
  MAVEN_CLI_OPTS: "-s /opt/apache-maven-3.6.3/conf/settings.xml --batch-mode"
  MAVEN_OPTS: "-Dmaven.repo.local=/home/gitlab-runner/.m2/repository"

cache:
  paths:
    - /home/gitlab-runner/.m2/repository/
    - target/

stages:
  - build

CodeBuild:
  stage: build
  script:
   - /opt/apache-maven-3.6.3/bin/mvn $MAVEN_CLI_OPTS -X clean package
  artifacts:
    name: “x—y-component"
    paths:
      - ./target/x—y-component.jar