maven issue ArtifactDescriptorException

2019-04-19 22:54发布

问题:

I am trying the Spring REST example exaplained here. The project source is here here.

I unzipped the file and renamed top folder to 'myproject' and imported it into eclipse as an existing maven project. But, observed that lot of compilation issues due to missing spring jars. I guess this is because maven is not able to import these jars. When I check the pom.xml, I see eclipse is complaining with below errors:

ArtifactDescriptorException: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.2.2: ArtifactResolutionException: Failure to transfer com.fasterxml.jackson.core:jackson-databind:pom:2.2.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:2.2.2 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.2.2/jackson-databind-2.2.2.pom

and

ArtifactDescriptorException: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.2.2: ArtifactResolutionException: Failure to transfer com.fasterxml.jackson.core:jackson-databind:pom:2.2.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:pom:2.2.2 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.2.2/jackson-databind-2.2.2.pom

I am new to maven so struggling here. Please help me how to fix it.

Thank you.

回答1:

For me, it was because Eclipse was caching the exception. Try to:

right click on project -> maven -> update-project -> force to update snapshot/release -> OK.

It worked for me for the same problem.



回答2:

try this helped me

right click on project -> maven -> update-project -> force to update snapshot/release -> OK.



回答3:

Can you try with dependency like :

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.3</version>

And try to run your Maven application using -U flag.



回答4:

The simplest solution is to remove the following folder within your local repository ${HOME}/.m2/repository/com/fasterxml/jackson and retry your build.

If it continues not to work you have to check if you have proxy between your computer and Maven central or if you have any network issues.



回答5:

I had a similiar problem with the same message!

The problem was that Eclipse (4.4 Luna) did not have the correct maven settings.

What helped me was:

Window > Preferences > Maven > User Settings > User Settings

Delete the %USERHOME% statement (or similar), type in the full path of your settings.xml and click on Update Settings, then maven update your projects again

Cheers!



回答6:

I had a similar issue after Proxy was disabled in my Company network. After removing in .m2/settings.xml <proxies>section, dependencies were updated properly. Please check, may be this is also your case.



回答7:

I had same issue while downloading "spring-boot-starter-hateoas" dependancy. The solution that worked for me was, upgrade "spring-boot-starter-parent" to Version 1.4.0.RELEASE (mine was 1.3.3 previously). Just for the reference : <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>**1.4.0.RELEASE**</version> </parent>