在 Eclipse 中创建一个 Maven 项目抱怨“无法解析原型”
我完全是Maven的新手。我想用Eclipse Juno EE创建一个带有原型“webapp”的Maven项目。我安装了“Maven Integration for Eclipse WTP(孵化)”,还安装了“Maven Integration for Eclipse”(在Eclipse Marketplace的“已安装”选项卡上找到它)。当我尝试从文件>New_>Maven项目创建新项目时,我得到错误:
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:RELEASE 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) 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)
它发生在各种原型中。我正在使用代理,并在 C:\Documents and Settings\PEP35KD.m2\ 下创建文件设置.xml内容如下:
<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本身,我认为插件就足够了:这是一个正确的假设吗?
更新问题肯定与代理有关。由:
- 在本地PC上安装Maven;
- 从Eclipse Market Place安装Maven Eclipse;
- 将 Maven 安装目录设置为本地 PC Maven dir,而不是默认的 Embedded Maven,
一切都如预期的那样工作。我真的不明白为什么,但可能是防火墙阻止了Maven服务器的流量。