java - 创建项目时 Eclipse Oxygen 上的 Maven 出现 "Could not resolve archetype"错误

标签 java eclipse maven

在 Eclipse Oxygen 中创建 maven-archtype 项目时出现以下错误。

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://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 org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://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 org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org

我可以使用以下链接从浏览器完美访问 Maven 存储库:

https://repo.maven.apache.org/maven2/

我正在使用我的办公室笔记本电脑,它位于安全网络后面。

通过引用其他类似问题的答案,我已经尝试将 settings.xml 放在 .m2 目录中。我不知道要使用哪个代理,因此我只是将系统凭据放入 usernamepassword 标记中。但这没有用。

我还尝试在 Eclipse Maven 设置中添加 Maven_Archtype。仍然无法工作。

有人遇到过这个问题吗?请指出正确的解决方案,它已经得到解答。

最佳答案

当您已经安装了 Eclipse 较旧版本(例如 Kepler 或 Mars),然后单独安装较新版本时,通常会发生这种情况,此较新版本会访问较旧版本的某些目录。因此,

  1. 转到----> C:\Users\Irfan(您的用户名)
  2. 删除这两个文件夹 .eclipse.m2
  3. 再次重新安装较新版本的 Eclipse。

关于java - 创建项目时 Eclipse Oxygen 上的 Maven 出现 "Could not resolve archetype"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44970149/

相关文章:

java - 您自己的 OpenID Connect 提供商(开源)

java - 如何使 Java 线程获得相当数量的 CPU 时间

java - Spring Boot - 数据源运行时错误

java - 生成 java 类到 src 不仅以 maven cxf-codegen-plugin 为目标

java - 设置新版本号并在 Maven 中一次性构建

JSON 输入文件中的 Java 对象

java - 与 hibernate 的 Tomcat 连接问题

java - Eclipse Maven 依赖项中存在冲突的 jar

android - 无法运行 Android 应用程序,在 Eclipse 中找不到 .apk 问题

javascript - 将 WebJars 与 Maven 结合使用 - 在 Intellij 和/或 Eclipse 上