Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
490 views
in Technique[技术] by (71.8m points)

dependencies - Missing artifact error in Maven

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.

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Is there a way to specify the value of someversion property used in the dependency pom?

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.

If not, how should the dependency pom be changed to resolve the error?

Use an "hard-coded" version in project.parent.version.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...