gpt4 book ai didi

java - 在Eclipse中创建一个Maven项目提示 "Could not resolve archetype"

转载 作者:IT老高 更新时间:2023-10-28 20:20:54 32 4
gpt4 key购买 nike

我完全是 Maven 的新手。我想用原型(prototype)为“webapp”的 Eclipse Juno EE 创建一个 Maven 项目。我安装了“Maven Integration for Eclipse WTP(孵化)”,我还安装了“Maven Integration for Eclipse”(在 Eclipse Marketplace 的已安装选项卡上找到它)。当我尝试从 File->New_>Maven Project 创建新项目时,出现错误:

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASEFailed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Documents and Settings\PEP35KD\.m2\repository)Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (C:\Documents and Settings\PEP35KD\.m2\repository)

It happens for all kinds of archetype.I am using a proxy, and I create file settings.xml under C:\Documents and Settings\PEP35KD.m2\ with this content:

<proxies>
<proxy>
<id>myId</id>
<active>true</active>
<protocol>http</protocol>
<username>rete\pep35kd</username>
<password>XXXX</password>
<host>XXXX</host>
<port>8080</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>

请考虑一下,我似乎无法从命令行使用 mvn 命令(找不到命令)。我从来没有安装过 Maven,我认为这个插件就足够了:这是一个正确的假设吗?

UPDATE 问题肯定与代理有关。作者:

  • 在本地 PC 上安装 Maven;
  • 从 Eclipse 安装 Maven Eclipse市场;
  • 将 Maven 安装目录设置为本地 PC Maven 目录,而不是默认的 Embedded Maven,

一切都按预期进行。我真的不明白为什么,但可能是防火墙阻止了 Maven 服务器的流量。

最佳答案

我按照 this other StackOverflow question 的解决方案解决了这个问题。

I had the same problem. I fixed it by adding the maven archetype catalog to eclipse. Steps are provided below: (Please note the https protocol)

  1. Open Window > Preferences
  2. Open Maven > Archetypes
  3. Click 'Add Remote Catalog' and add the following:

关于java - 在Eclipse中创建一个Maven项目提示 "Could not resolve archetype",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15506043/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com