微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sonatype Nexus3发送错误的网址来下载工件

如何解决Sonatype Nexus3发送错误的网址来下载工件

标题中所述,Nexus3发送了错误的网址来下载工件。

我在控制台上收到以下错误

[INFO] Scanning for projects...
Downloading from maven-group: http://localhost:8081/repository/backend-group/br/edu/sig/backend/0.0.1-SNAPSHOT/maven-Metadata.xml
[WARNING] Could not transfer Metadata br.edu.sig:backend:0.0.1-SNAPSHOT/maven-Metadata.xml from/to maven-group (http://localhost:8081/repository/backend-group/): Transfer Failed for http://localhost:8081/repository/backend-group/br/edu/sig/backend/0.0.1-SNAPSHOT/maven-Metadata.xml
Downloading from maven-group: http://localhost:8081/repository/backend-group/br/edu/sig/backend/0.0.1-SNAPSHOT/backend-0.0.1-SNAPSHOT.pom

我通过此错误了解到,maven尝试下载下图中蓝色箭头所示的xml,它不能,紧接着它会警告它无权访问“后端组”存储库,但是即使如此它尝试下载带有黑色箭头的pom,但该网址已忽略了红色箭头数据包,因此由于存在404错误而无法下载。

我相信我在settings.xml中可能做错了,但是我不知道是什么。

注意:联系位于url本地主机:8081的docker容器中。

Packages in the nexus snapshot repository

docker-compose:

version: '3.7'

services:
  nexus:
    container_name: sighepr-nexus
    image: sonatype/nexus3:latest
    restart: always
    ports:
      - 8081:8081
    volumes:
      - ./nexus3:/nexus-data

... /。m2 / settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
    <servers>
        <server>
            <id>nexus-snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>nexus-releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>
    
    <mirrors>
        <mirror>
            <id>nexus-group</id>
            <name>nexus-group</name>
            <url>http://localhost:8081/repository/backend-group/</url>
            <mirrorOf>*</mirrorOf>
        </mirror>
    </mirrors>
</settings>

后端Pom

<modelVersion>4.0.0</modelVersion>
<name>backend</name>
<groupId>br.edu.sig</groupId>
<artifactId>backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<build>
    <plugins>
        <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.8</version>
            <extensions>true</extensions>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

<distributionManagement>
    <snapshotRepository>
        <id>nexus-snapshots</id>
        <url>http://localhost:8081/repository/backend-snapshots/</url>
    </snapshotRepository>
    <repository>
        <id>nexus-releases</id>
        <url>http://localhost:8081/repository/backend-releases/</url>
    </repository>
</distributionManagement>

微服务pom

<parent>
    <groupId>br.edu.sig</groupId>
    <artifactId>backend</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
</parent>

<modelVersion>4.0.0</modelVersion>
<name>authentication</name>
<artifactId>authentication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<build>
    <finalName>authentication</finalName>
</build>

<repositories>
    <repository>
        <id>maven-group</id>
        <url>http://localhost:8081/repository/backend-group/</url>
    </repository>
</repositories>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。