java - maven 问题 ArtifactDescriptorException

标签 java eclipse spring rest maven

我正在尝试解释的 Spring REST 示例 here . 项目源码在这里here .

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

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

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

我是 maven 的新手,所以在这里苦苦挣扎。请帮我解决它。

谢谢。

最佳答案

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

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

同样的问题对我有用。

关于java - maven 问题 ArtifactDescriptorException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19246860/

相关文章:

java - hibernate4-maven-plugin 找不到带注释的类

java - 远程调试java应用程序时JDWP错误: No agent option specified: address,

java - 字符串 "For input string: "-l"被执行并输出,即使它不存在于代码中(java线程)

java - SonarLint eclipse : Does it also analyze source code in "src/test"?

java - 如何在Eclipse中的antbuildfile中添加 Sonar

java - 首次登录时无法打开 Hibernate Session 进行事务处理

java - 从 REST API 返回 ResponseEntity<byte[]> 时出现问题。为什么?

java - 具有重复键的映射行为

java - app-context.xml 的完整 Java 配置,包括 jdbc 和 tx 指令等

java - HttpURLConnection 和获取 ASPX 页面