Maven 中缺少工件错误 [英] Missing artifact error in Maven

查看:26
本文介绍了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.

有没有办法指定依赖 pom 中使用的 someversion 属性的值?如果没有,应该如何更改依赖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屋!

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