Maven Nexus 找不到依赖项

问题描述 投票:0回答:1

我在本地网络上安装了 Nexus OSS 3.29,并且可以启动和浏览 http://somehost:8081/。我将

commons-lang-3.1.jar
上传到
maven-releases
,我可以在那里看到它。我在 Eclipse 中有一个 Maven 项目,我在其中定义了依赖项:

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>3.1</version>
</dependency>

在我的

settings.xml
中,我定义了存储库:

<profiles>
    <profile>
      <id>java-net-public</id>
      <repositories>
        <repository>
          <id>java-net-public</id>
          <name>Java Net Public</name>
          <url>http://somehost:8081/maven-releases/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
....
</profile>
.....
</profiles>

当我构建项目

Run As -> Maven Install with -e option
时,我收到错误:

在 java-net-public (http://somehost:8081/maven-releases/) 中找不到工件 commons-lang:commons-lang:jar:3.1。

我尝试将存储库定义添加到我的

pom.xml
,但没有成功。

maven pom.xml nexus nexus3 apache-commons-lang3
1个回答
0
投票

显然,当使用 Nexus 作为存储库时,URL 应该如下所示:

http://somehost:8081/repository/

一旦我将“repository”添加到 URL Maven 依赖项就得到了解决。

© www.soinside.com 2019 - 2024. All rights reserved.