Java Nexus / Maven - 缺少...的 POM,没有可用的依赖信息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28349129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 06:04:40  来源:igfitidea点击:

Nexus / Maven - The POM for ... is missing, no dependency information available

javamavenpom.xmlnexus

提问by Danilo Mu?oz

I'm facing a bunch of warnings like "The POM for ... is missing, no dependency information available" while building my maven java project.

在构建我的 maven java 项目时,我面临着一堆警告,比如“缺少......的 POM,没有可用的依赖信息”。

The artifacts are stored in the Nexus server hosted in our company. The problem started after I scheduled a task in Nexus to "Remove Releases From Repository" in order to clean up it and maintain only the 2 last releases.

工件存储在我们公司托管的 Nexus 服务器中。在我将 Nexus 中的任务安排为“从存储库中删除版本”以清理它并仅维护最后两个版本后,问题就开始了。

Because of that, I'm receiving these warnings for the old-removed releases:

正因为如此,我收到了这些旧版本的警告:

[WARNING] The POM for xpto:jar:jar:8.16.1 is missing, no dependency information available
[WARNING] The POM for xpto:jar:jar:8.17.0 is missing, no dependency information available
[WARNING] The POM for xpto:jar:jar:8.18.0 is missing, no dependency information available
[WARNING] The POM for xpto:jar:jar:8.19.0 is missing, no dependency information available

Once I have many component projects and the releases are constants, when a compile some project that use these components, I get a lot of warnings like that.

一旦我有很多组件项目并且发布是常量,当编译一些使用这些组件的项目时,我会收到很多这样的警告。

Do you guys propose some way to avoid these warning or execute some goal at client side that could re-resolve or reindex the dependencies?

你们是否提出了一些方法来避免这些警告或在客户端执行一些可以重新解析或重新索引依赖项的目标?

Regards,

问候,

采纳答案by Danilo Mu?oz

Sometimes Releases are Disposable

有时发布是一次性的

As the article above describes, depending on your business, you may not need to store old releases on your own repository. I'm included in this scenario.

正如上面的文章所描述的,根据您的业务,您可能不需要将旧版本存储在您自己的存储库中。我被包括在这个场景中。

In order to maintain, for example, only the 2 last releases from my component projects, some steps should be followed in order to avoid the maven [WARNING] messages:

例如,为了维护我的组件项目的最后 2 个版本,应该遵循一些步骤以避免 maven [警告] 消息:

1. Remove releases from repository

1.从存储库中删除版本

You should add a task to your repository to maintain the only nrelease itens. This can be done by:

您应该向您的存储库添加一个任务来维护仅有的n 个发布项目。这可以通过以下方式完成:

  • Go to Sonatype Nexus > Administration > Scheduled Tasks > Add
  • Set "Task Type" to "Remove Releases From Repository"
  • Setup your own parameters (e-mail, recurrence, etc.)
  • 转到 Sonatype Nexus > 管理 > 计划任务 > 添加
  • 将“任务类型”设置为“从存储库中删除版本”
  • 设置您自己的参数(电子邮件、重复等)

2. Rebuild maven metadata files

2.重建maven元数据文件

The "ace in the hole" for this question is to rebuild the maven metadata files (maven-metadata.xml), once they were going to maintain the old releases information until the time they are going to be rebuild. This can be done by:

这个问题的“王牌”是重建 maven 元数据文件 (maven-metadata.xml),一旦他们要维护旧版本信息,直到他们将要重建。这可以通过以下方式完成:

  • Go to Sonatype Nexus > Administration > Scheduled Tasks > Add
  • Set "Task Type" to "Rebuild Maven Metadata Files"
  • Setup your own parameters (e-mail, recurrence, etc.)
  • Attention: this task must run after the "Remove Releases From Repository"
  • 转到 Sonatype Nexus > 管理 > 计划任务 > 添加
  • 将“任务类型”设置为“重建 Maven 元数据文件”
  • 设置您自己的参数(电子邮件、重复等)
  • 注意:此任务必须在“Remove Releases From Repository”之后运行

3. Local repository

3. 本地仓库

Now, the local repository need to know that metadata files were updated. This can be done by the parameter:

现在,本地存储库需要知道元数据文件已更新。这可以通过参数完成:

  • mvn -U:

    -U,--update-snapshots Forces a check for updated releases and snapshots on remote

  • For example:

    mvn -U clean package

  • mvn -U:

    -U,--update-snapshots 强制检查远程更新版本和快照

  • 例如:

    mvn -U 干净的包

References

参考

回答by B. Carpenter

Check your settings.xml, i.e. exported as such in bash:

检查您的settings.xml, 即在 bash 中导出的文件:

export MVN_SETTINGS=~/.m2/settings.xml 

This warning typically appears when you can't download the dependencies from the internet.

当您无法从 Internet 下载依赖项时,通常会出现此警告。