简体   繁体   中英

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

Please find the below logs:

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

Thanks in advance!

This failes likely due to an artifact downloaded earlier (in my case.m2/repository/org/geotools/geotools/19.1/geotools-19.1.pom) containing this as a specific repo, maybe even retrieved from a thirdparty repo.

Check your local artifacts for references to the repository, eg by this brute force approach:

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

Replacing/removing the dependency solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM