Maven 无法通过本地 Nexus 存储库解决依赖关系

发布于 2024-12-14 13:33:56 字数 1395 浏览 1 评论 0原文

当使用我们的本地 Nexus 存储库进行配置时,为什么 Maven 无法解决与 Maven Central 的依赖关系?

我设置了一个内部 Sonatype Nexus 存储库 并配置 Maven 以检查我的本地 Nexus,而不是直接从公共存储库获取工件。 我们的项目能够下载最多的工件,除了 Maven 中心的一个工件。 这是构建错误:

Failed to execute goal on project shindig-gadgets: 
Could not resolve dependencies for project org.apache.shindig:shindig-gadgets:jar:3.0.0-SNAPSHOT: Could not find artifact com.ibm.icu:icu4j:jar:4.6 
in nexus (http://my_nexus_repository:8081/nexus/content/groups/public) -> [Help 1]

我看到 Maven 中央存储库中确实存在 icu4j-4.6.jar 。在我的本地 Nexus 存储库中,这个 jar 不存在。
我看到我的本地 nexus 存储库中仅存在 icu4j-4.6.pom
Maven 项目已通过我的本地 Nexus maven 存储库从多个公共存储库成功下载了许多 jar 文件(icu4j-4.6.jar 除外)。

类似问题描述于 使用 nexus 设置缺少 Maven 依赖项 icu4j-4.6.jar 未显示在搜索列表中。只有 icu4j-4.6.pom 显示在搜索列表中。我不认为是快照 VS 发布问题,因为 icu4j-4.6.jar 似乎是发布 jar。

我不明白为什么我只使用 icu4j-4.6.jar 就遇到问题。
它会被错误地缓存在我的本地 Maven 或 Nexus Maven 存储库上吗?
如果缓存不正确,如何清理本地 Maven 或 Nexus Maven 存储库?

Why is Maven unable to resolve dependency with maven central when configured with our local Nexus Repository?

I setup an in-house Sonatype Nexus repository and configure the maven to check my local Nexus instead of getting artifacts directly from public repositories.
Our project was able to download the most artifacts except one artifact in Maven central.
Here is the build error:

Failed to execute goal on project shindig-gadgets: 
Could not resolve dependencies for project org.apache.shindig:shindig-gadgets:jar:3.0.0-SNAPSHOT: Could not find artifact com.ibm.icu:icu4j:jar:4.6 
in nexus (http://my_nexus_repository:8081/nexus/content/groups/public) -> [Help 1]

I see that icu4j-4.6.jar does exist in the Maven central repository. On my local nexus repository, this jar doesn't exist.
I see only icu4j-4.6.pom exists on my local nexus repository.
Maven project has successfully downloaded numerous jar files from multiple public repositories via my local nexus maven repository except icu4j-4.6.jar.

The similar problem is described at
Missing maven dependency using nexus setup
icu4j-4.6.jar does not show up in the search list. Only icu4j-4.6.pom shows up in the search list. I don't think is Snapshot VS Release issue because icu4j-4.6.jar seems release jar.

I don't understand why I'm having a problem with only icu4j-4.6.jar.
Would it be incorrectly cached on either my local maven or nexus maven repository?
If it was incorrectly cached, how can I clean the local maven or nexus maven repository?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

初见终念 2024-12-21 13:33:56

Nexus 存储库是否有可能停止响应一段时间?您可以尝试 mvn -X (或 -d?) 来获取有关正在发生的情况的详细信息。您也可以尝试配置替代存储库。

Is it possible that the nexus repo just stopped responding for a while? You can try mvn -X (or -d?) to get detailed info about what is going on. You might also try configuring an alternative repo.

涙—继续流 2024-12-21 13:33:56

也许您尚未启用远程索引下载 来自 Maven 中心。这可以解释为什么只有 POM 文件出现在本地搜索中(通过代理存储库下载的唯一文件)。

可能还有另一个问题导致 jar 本身下载失败......我想尝试一次解决一个问题:-)

Perhaps you haven't enabled remote index downloads from Maven Central. This would explain why only the POM file appears in your local search (The only file which has been downloaded via the proxy repo).

There might be another issue causing the download failure for the jar itself.... I suppose try and solve one problem at a time :-)

百思不得你姐 2024-12-21 13:33:56

尝试将 -U 添加到您的 mvn 参数中以强制更新本地存储库。

您的存储库中也可能有损坏的元数据。在这种情况下,请从存储库的缓存中删除该工件并让它刷新。

Try adding -U to your mvn arguments to force an update of your local repository.

You could also have corrupt meta data in the repo. In which case, delete that artifact from the repo's cache and let it refresh.

那请放手 2024-12-21 13:33:56

如果有问题的工件已从代理存储库中正确缓存,则使用 mvn -U 将解决问题。

但是,如果您在 nexus 上看到 pom,这通常是在代理存储库中的工件未正确缓存时发生的。修复的方法是

1) 浏览到代理存储库中的组件。

2) 使存储库的缓存失效并重新索引 Nexus 存储库。

3) 运行 mvn clean -U

If the artifact in question was cached in properly from the proxy repository, using mvn -U will fix the problem

However if you are seeing pom on your nexus ,this usually happens when the artifact from the proxy repository is not cached in properly. The way to fix is

1) Browse to the component in the Proxy Repository.

2) Invalidate the cache for the repository and reindex the Nexus repository.

3) run mvn clean -U

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文