调试Maven的“工件没有有效范围" [英] Debugging Maven's "The artifact has no valid ranges"

查看:170
本文介绍了调试Maven的“工件没有有效范围"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们经常在工作中使用Maven,我们会收到错误消息工件没有有效范围".经过长时间的Google搜索和试验,我意识到了该错误消息的含义:工件确实具有有效范围,但范围太多.

We're using Maven at work at quite regularly we get the error message "The artifact has no valid ranges". After a long time of Googling and experimenting I realised what this error message means: The artifact does have valid ranges, just too many of them.

例如,我的主POM仅依赖于superframework v.1.0,但是也具有对superframework v.0.5-0.9的传递依赖.

For example, my master POM has a dependency on superframework v.1.0 only, but there is also a transitive dependency on superframework v.0.5-0.9.

直到现在,每当我遇到这样的问题时,我都会查看(非常隐秘的)错误消息,并猜测出我需要更改哪个POM-基本上是尝试很多错误.问题是如果遇到依赖项解析问题,mvn dependency:tree不起作用.

Until now, whenever I had such a problem I've looked at the (very cryptic) error message and sorta guessed which POM I needed to change - basically a lot of trial an error. The problem is that mvn dependency:tree doesn't work if you have a dependency resolution problem.

Eclipse插件有时会有所帮助,但有时会有所帮助.

The Eclipse plugin sometimes helps a little, but sometimes it is way off.

有关如何解决这些问题的任何提示?

Any tips on how to resolve these problems?

推荐答案

这可能不是预期的答案,但我的建议是实际上使用依赖范围,因为它们会使构建的可复制性恶化.

This might not be the expected answer but my advice would be to actually not use dependency ranges as they worsen build reproducibility.

我更喜欢使用固定版本(这也使依赖冲突解决更加容易,请参见

I prefer to use fixed versions (which also make dependencies conflicts resolution easier, see the note at the bottom of 9.4.3. Dependency Version Ranges) and use intensively the Dependency Convergence report to manage them.

这篇关于调试Maven的“工件没有有效范围"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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