【发布时间】:2019-12-07 17:08:31
【问题描述】:
问题是手动将工件上传到发布存储库,而不是从settings.xml 中定义的 Nexus 组存储库解析。
我尝试将http://localhost:8081/nexus/content/repositories/releases 存储库包含到/nexus/content/groups/public 存储库中,并将组存储库路径定义为settings.xml 中的镜像。
<settings>
.......
<mirrors>
<mirror>
<id>myteam-nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/public </url>
</mirror>
</mirrors>
.....
</settings>
在 Nexus 中,我有如下自定义 JAR:
<dependency>
<groupId>com.xxxx.bank</groupId>
<artifactId>xxxxxcallws</artifactId>
<version>1.0</version>
</dependency>
pom.xml
<project>
<dependencies>
<dependency>
<groupId>com.xxxx.bank</groupId>
<artifactId>xxxxxcallws</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<!-- CHANGE HERE by your team nexus server -->
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<!-- CHANGE HERE by your team nexus server -->
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
当我运行 mvn clean install -U 时出现错误提示:
在 myteam-nexus (http://localhost:8081/nexus/content/groups/public) 中找不到工件 com.xxxx.bank:xxxxxcallws:jar:1.0
注意:此 JAR 已上传到发布存储库 (http://localhost:8081/nexus/content/repositories/releases),我已从 Nexus 管理 UI 将相同的存储库添加到公共组存储库中。
但同样的方式,我将 Maven Central 代理添加到公共组中,并且来自 Central 的依赖项正在拉取,但我上传的 JAR 无法通过公共存储库找到位置。
【问题讨论】:
-
您是否尝试过在 NXRM 端使缓存无效,以防它(而不是 maven)缓存了一个未找到的对象?你在 UI 中看到了 jar 吗?
-
是的 jar 我可以在 nexus 中看到,因为它是手动上传的
-
您是否检查了 NXRM 中的路径与 maven 所说的内容?例如您可以通过网络浏览器或 curl(具有适当权限)下载localhost:8081/nexus/content/groups/public/com.xxxx.bank/… 吗?您必须填写 xxxxx 空白,但希望您能理解我的想法=)
标签: maven maven-2 pom.xml nexus dependency-management