在Maven中丢失工件错误 [英] Missing artifact error in Maven
问题描述
在Maven构建期间,我收到一个缺失的工件错误,因为其中一个依赖关系声明它是使用该版本的属性的父工件。现在,属性本身在父pom中声明,并且我的项目的构建失败,给出了这个错误:
I get a missing artifact error during Maven build because one of the dependencies declares it's parent artifact using a property for the version. Now the property itself is declared in the parent pom and my project's build fails giving this error:
[ERROR] Failed to execute goal on project abc: Unable to get dependency
information for xyz:pqr:jar:SNAPSHOT: Failed to process POM for
xyz:pqr:jar:SNAPSHOT: Non-resolvable parent POM xyz:pqr-parent:${someversion}
for xyz:pqr:${someversion}: Failed to resolve POM for
xyz:pqr-parent:${someversion} due to Missing:
----------
1) xyz:pqr-parent:pom:${someversion}
----------
1 required artifact is missing.
for artifact:
xyz:pqr-parent:pom:${someversion}
我已经验证了工件存在于存储库中的正确位置。
I have verified that the artifacts are present in correct location in the repository.
有没有办法指定 someversion
属性在依赖pom中使用?
如果没有,应该如何更改依赖性pom来解决错误?
Is there a way to specify the value of someversion
property used in the dependency pom?
If not, how should the dependency pom be changed to resolve the error?
推荐答案
我在Maven构建期间收到一个缺失的工件错误,因为其中一个依赖关系使用该版本的属性来声明它的父工件。现在,属性本身在父pom中被声明,我的项目的构建失败了给出这个错误(...)
I get a missing artifact error during Maven build because one of the dependencies declares it's parent artifact using a property for the version. Now the property itself is declared in the parent pom and my project's build fails giving this error (...)
这是一个鸡和蛋问题:您无法从父级获取父级使用的版本。
This is a chicken and egg problem: you can't get the version of the parent to use from the parent.
有没有办法指定在依赖性pom中使用的someversion属性的值?
Is there a way to specify the value of someversion property used in the dependency pom?
AFAIK,这是不可能的,project.parent.version中的属性不会被替换。您可能需要查看 MNG-624 (并投票支持)和相关问题。
AFAIK, this is not possible, properties in project.parent.version do NOT get substituted. You might want to check MNG-624 (and vote for it) and related issues.
如果没有,应该如何更改依赖性pom来解决错误?
If not, how should the dependency pom be changed to resolve the error?
在project.parent.version中使用硬编码版本。
Use an "hard-coded" version in project.parent.version.
这篇关于在Maven中丢失工件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!