【发布时间】:2017-01-06 11:44:19
【问题描述】:
我们有一个 nexus-server,它有一个通用的 maven-public 存储库组,其中包含每个外部代理存储库(例如 maven-central)。除此之外,我们还有一个本地托管存储库。我们称它为 MyProjectRepository。它分为发布回购和快照回购。
所以,目前看起来是这样的:
- MyProjectRepository
- MyProjectRepository-快照
- ArtifactOne
- 快照 5
- ...
- 快照 1
- 神器二
- 快照 3
- ...
- 快照 1
- ArtifactOne
好的,ArtifactTwo 需要 ArtifactOne 作为依赖项。所以,我在依赖项部分添加了这个:
<dependency>
<groupId>com.company</groupId>
<artifactId>artifactone</artifactId>
<version>0.0.5</version>
</dependency>
我已经像这样配置了存储库部分:
<repository>
<id>myprojectrepositoryss</id>
<name>MyProjectRepository Snapshots</name>
<url>http://mylocalnexus.com/nexus/repository/MyProjectRepository-Snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
我的 settings.xml 镜像部分如下所示:
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>external:*, !myprojectrepositoryss</mirrorOf>
<url>http://mylocalnexus.com/nexus/repository/maven-public/</url>
</mirror>
我的 settings.xml 配置文件部分如下所示:
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
尽管设置了教程中描述的所有内容,但我的 IDE 指出无法找到给定依赖项中的工件。
未能在项目 ArtifactTwo 上执行目标:无法解决 项目 com.company:ArtifactTwo:jar:0.0.3-SNAPSHOT 的依赖项: 找不到 com.company:artifactone:jar:0.0.5 in http://mylocalnexus.com/nexus/repository/maven-public/ 被缓存在 本地存储库,解析将不会重新尝试,直到 nexus 的更新间隔已过或强制更新
为什么要在“maven-public”中搜索依赖? 有人知道如何让它工作吗?
【问题讨论】: