簡體   English   中英

如何解決Maven項目中的central.maven.org:未知主機central.maven.org?

[英]How to resolve central.maven.org: Unknown host central.maven.org in Maven Project?

請找到以下日志:

[ERROR] Failed to execute goal on project hospital: Could not resolve dependencies for project 
com.project_name.test.web:hospital:war:0.0.1-SNAPSHOT: Failed to collect dependencies at 
com.example.test:example-child:jar:1.1.12-SNAPSHOT: Failed to read artifact descriptor for 
com.example.test:example-child:jar:1.1.12-SNAPSHOT: Could not transfer artifact 
com.example.test:example-parent:pom:1.1.12-SNAPSHOT from/to maven-central
(http://central.maven.org/maven2/): central.maven.org: Unknown host central.maven.org -> [Help 1]

提前致謝!

這可能是由於之前下載的工件(在我的情況下為.m2/repository/org/geotools/geotools/19.1/geotools-19.1.pom)包含此作為特定存儲庫,甚至可能從第三方存儲庫中檢索到的。

檢查您的本地工件以獲取對存儲庫的引用,例如通過這種蠻力方法:

grep -nr "central.maven.org" ~/.m2/repository/

替換/刪除依賴項解決了這個問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM