Nexus/Maven-缺少用于...的POM,没有可用的依赖项信息 [英] Nexus / Maven - The POM for ... is missing, no dependency information available

查看:1074
本文介绍了Nexus/Maven-缺少用于...的POM,没有可用的依赖项信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建我的maven java项目时,我遇到一堆警告,例如缺少...的POM,没有可用的依赖项信息".

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

工件存储在我们公司托管的Nexus服务器中.在我将Nexus中的任务计划为从存储库中删除发行版"以清理并仅维护最后2个发行版之后,问题就开始了.

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.

因此,我收到有关旧版本的警告:

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?

此致

推荐答案

如上文所述,根据您的业务,您可能不需要将旧版本存储在自己的存储库中.我被包括在这种情况下.

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.

例如,为了仅维护组件项目中的最后2个发行版,应遵循一些步骤,以避免出现Maven [WARNING]消息:

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:

您应将一个任务添加到存储库中,以维护唯一的 n 版本.这可以通过以下方式完成:

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

  • 转到Sonatype Nexus>管理">计划任务">添加"
  • 将任务类型"设置为从存储库中删除发行版"
  • 设置您自己的参数(电子邮件,重复发生等)

此问题的坑中之王"是一旦要维护旧版本的信息直到要重建它们,就重建maven元数据文件(maven-metadata.xml).这可以通过以下方式完成:

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:

  • 转到Sonatype Nexus>管理">计划任务">添加"
  • 将任务类型"设置为重建Maven元数据文件"
  • 设置您自己的参数(电子邮件,重复发生等)
  • 注意:此任务必须在从存储库中删除发行版"之后运行.
  • 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"

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

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

  • mvn -U:

  • mvn -U:

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

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

例如:

mvn -U清洁程序包

mvn -U clean package

  • Can I delete releases from Nexus after they have been published?
  • What do the scheduled tasks in Nexus do, and how often should I run them?
  • How to force maven to update local repo

这篇关于Nexus/Maven-缺少用于...的POM,没有可用的依赖项信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆