我们有一个连接服务器,它有公共maven-公共存储库组,包含每个外部代理存储库(例如,maven-central)。此外,我们还有一个本地托管存储库。我们叫它MyProjectRepository吧。它分为发行版和快照版。
所以,目前看起来是这样的:
- ArtifactTwo
- Snapshot-3
- ...
- Snapshot-1
好的,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-快照:未能找到com.Company:ArtifactTwo:jar:http://mylocalnexus.com/nexus/repository/maven-public/中的0.0.5被缓存在本地存储库中,在nexus的更新间隔过去或被迫更新之前,不会重新尝试解析
为什么它要搜索"maven-public“中的依赖项?有谁知道如何让这件事成功吗?
发布于 2016-08-30 15:49:55
它按需要在maven-public组中搜索,并在设置文件中的镜像URL中进行配置。
您只需要将您的项目存储库添加到maven-public存储库组中,它就能正常工作。
发布于 2020-07-26 10:53:49
这是很奇怪的,但是在<distributionManagement>中声明一个存储库以部署项目快照或发布到的,并没有将它默认为下载项目快照或发布的存储库。我的解决方案是提供一个显式的<repositories>部分,列出<distributionManagement>部分中的快照和发布存储库。
请注意,本地和远程存储库的高度缓存结构和Maven在本地标记工件的“习惯”--它在白天找不到它是无法尝试的--这使对情况的分析变得非常复杂。使用-U Maven选项确实有助于解决这个问题。
https://stackoverflow.com/questions/39223265
复制相似问题