我在本地网络上安装了 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>
当我构建我的项目(RunAs->Maven Install with -e option)时,我收到一个错误:
Could not find artifact commons-lang:commons-lang:jar:3.1 in java-net-public (http://somehost:8081/maven-releases/)
我觉得我缺少一些配置设置,不确定它是什么。我还尝试将存储库定义添加到我的“pom.xml”中,但没有成功。
答案 0 :(得分:0)
显然,当使用 Nexus 作为存储库时,URL 应如下所示:
http://somehost:8081/repository/
一旦我将“存储库”添加到 URL Maven 依赖项就得到了解决。