Я использую конвейер Gitlab CI / CD для компиляции кода и загрузки сгенерированного артефакта в репозиторий Nexus. Но я получаю ошибку ниже при выполнении mvn $ MAVEN_CLI_OPTS deploy -Dmaven.test.skip = true в gitlab-ci.yml
[MAVEN_CLI_OPTS: "-s .m2 / settings. xml --batch- mode "]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-
deploy) on project demo: Failed to retrieve remote metadata com.example:demo:0.0.1-SNAPSHOT/maven-
metadata.xml: Could not transfer metadata com.example:demo:0.0.1-SNAPSHOT/maven-metadata.xml from/to
snapshots (http://localhost:8081/repository/Test_gitlab_nexus/): Transfer failed for
http://localhost:8081/repository/Test_gitlab_nexus/com/example/demo/0.0.1-SNAPSHOT/maven-
metadata.xml: Connect to localhost:8081 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed:
Connection refused -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Ниже приведен пом. 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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath />
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<name>Central</name>
<url>http://localhost:8081/repository/Test_gitlab_nexus/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
</repository>
</repositories>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://localhost:8081/repository/Test_gitlab_nexus/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>