2010-05-31 62 views
2

在Maven構建過程中,我得到了缺失的工件錯誤,因爲其中一個依賴聲明使用該屬性的父工件。現在物業本身在父POM是聲明,我的項目的構建失敗給這個錯誤:Maven中缺少工件錯誤

[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} 

我已驗證了文物存在於存儲庫中的正確位置。

有沒有辦法指定在dependency pom中使用的someversion屬性的值? 如果不是,應如何更改依賴項來解決錯誤?

回答

4

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 (...)

這是一個雞和雞蛋的問題:您無法從父級獲取父級版本。

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

AFAIK,這是不可能的,project.parent.version中的屬性不會被替換。您可能需要檢查MNG-624(併爲其投票)和相關問題。

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

在project.parent.version中使用「硬編碼」版本。