Java Maven 问题 ArtifactDescriptorException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19246860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 15:25:19  来源:igfitidea点击:

maven issue ArtifactDescriptorException

javaeclipsespringrestmaven

提问by user2381731

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

我正在尝试这里解释的 Spring REST 示例。项目来源在这里

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:

我解压缩文件并将顶层文件夹重命名为“myproject”,并将其作为现有的 maven 项目导入到 eclipse 中。但是,观察到由于缺少 spring jars 导致的很多编译问题。我想这是因为 maven 无法导入这些 jars。当我检查 pom.xml 时,我看到 eclipse 抱怨以下错误:

ArtifactDescriptorException: Failed to read artifact descriptor for com.fasterxml.Hymanson.core:Hymanson-databind:jar:2.2.2: ArtifactResolutionException: Failure to transfer com.fasterxml.Hymanson.core:Hymanson-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.Hymanson.core:Hymanson-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/Hymanson/core/Hymanson-databind/2.2.2/Hymanson-databind-2.2.2.pom

and

ArtifactDescriptorException: Failed to read artifact descriptor for com.fasterxml.Hymanson.core:Hymanson-databind:jar:2.2.2: ArtifactResolutionException: Failure to transfer com.fasterxml.Hymanson.core:Hymanson-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.Hymanson.core:Hymanson-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/Hymanson/core/Hymanson-databind/2.2.2/Hymanson-databind-2.2.2.pom

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

我是 maven 的新手,所以在这里挣扎。请帮助我如何修复它。

Thank you.

谢谢你。

回答by user9873999

Can you try with dependency like :

您可以尝试使用依赖项,例如:

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

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

并尝试使用 -U 标志运行您的 Maven 应用程序。

回答by khmarbaise

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

最简单的解决方案是删除本地存储库中的以下文件夹${HOME}/.m2/repository/com/fasterxml/Hymanson并重试构建。

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.

如果它继续不起作用,您必须检查您的计算机和 Maven 中心之间是否有代理,或者您是否有任何网络问题。

回答by Saman Abdolmohammadpour

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

对我来说,这是因为 Eclipse 正在缓存异常。尝试:

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

右键单击项目 -> maven -> 更新项目 -> 强制更新快照/发布 -> 确定。

It worked for me for the same problem.

对于同样的问题,它对我有用。

回答by themenace

I had a similiar problem with the same message!

我对相同的消息有类似的问题!

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

问题是 Eclipse (4.4 Luna) 没有正确的 maven 设置。

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.xmland click on Update Settings, then maven updateyour projects again

删除%USERHOME%语句(或类似语句),输入settings.xml的完整路径并单击Update Settings,然后maven再次更新您的项目

Cheers!

干杯!

回答by Vitaliy Khmel

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.

在我的公司网络中禁用代理后,我遇到了类似的问题。删除.m2/settings.xml<proxies>部分后,依赖项已正确更新。请检查,可能这也是您的情况。

回答by Umesh Bhutada

try this helped me

试试这对我有帮助

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

右键单击项目 -> maven -> 更新项目 -> 强制更新快照/发布 -> 确定。

回答by Akshada

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>

我在下载“spring-boot-starter-hateoas”依赖时遇到了同样的问题。对我有用的解决方案是,将“spring-boot-starter-parent”升级到版本 1.4.0.RELEASE(我之前是 1.3.3)。仅供参考: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>**1.4.0.RELEASE**</version> </parent>