嗨,我无法在我的机器上创建Maven Project。以下是我的配置

Eclipse Version: Mars.1 Release (4.5.1)
Maven Version: m2e, Maven Integration for Eclipse, 1.6.2


我在公司代理后面。我试图在.m2目录中配置设置文件,但它不起作用。以下是我的设置文件

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<proxies>
 <proxy>
 <id>myproxy</id>
 <active>true</active>
 <protocol>http</protocol>
 <host>XX.XX.XX.XX</host>
 <port>8080</port>
 <nonProxyHosts></nonProxyHosts>
 <username>USERNAME</username>
 <password>PASSWORD</password>
 </proxy>
 </proxies>

</settings>


我在StackOverflow中看到了很多与此问题有关的答案,但是我尝试了却没有任何效果。我怀疑密码中是否有'@'字符,是否会引起任何问题?另外,我们是否需要提供USERNAME作为domain \ USERNAME或仅提供USERNAME?以及如何在文件中同时提供http和https?

堆栈跟踪错误

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): connect timed out

最佳答案

在我的经验中。


“ @”字符不是关键问题,因为我的密码也包含此字符。
域不是必须添加
实际上,您可以尝试以下方式:


在IDE中配置代理信息(例如:eclipse),而不是settgins.xml中的config,这意味着删除maven设置文件中的所有配置

07-24 09:47
查看更多