maven issue ArtifactDescriptorException

2019-04-19 23:18发布

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.

7条回答
趁早两清
2楼-- · 2019-04-19 23:33

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.

查看更多
聊天终结者
3楼-- · 2019-04-19 23:35

try this helped me

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

查看更多
Rolldiameter
4楼-- · 2019-04-19 23:35

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.

查看更多
Juvenile、少年°
5楼-- · 2019-04-19 23:37

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>

查看更多
成全新的幸福
6楼-- · 2019-04-19 23:44

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.

查看更多
贼婆χ
7楼-- · 2019-04-19 23:46

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.

查看更多
登录 后发表回答