我正在尝试使用maven创建一个spring mvc项目并在pom.xml中收到以下错误:
CoreException:无法计算构建计划:插件org.apache.maven.plugins:maven-compiler-plugin:2.3.2或其中一个依赖项无法解析:无法读取org.apache.maven的工件描述符.plugins:maven-compiler-plugin:jar:2.3.2:ArtifactResolutionException:无法从http:// repo.maven.apache传输org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2。 org / maven2缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析。原始错误:无法传输工件org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from / to central(http:// repo.maven.apache.org/maven2):连接被拒绝:否有关http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom
的更多信息
是否与代理或防火墙有关?我该怎么做才能解决它?
答案 0 :(得分:12)
听起来您需要在settings.xml
中设置maven代理。
在网络浏览器中查看(例如)并查看其设置方式。
来自Configuring a proxy的文档:
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
</proxy>
答案 1 :(得分:0)
我通过修复存储库修复了一个类似的问题(即无法传输工件......连接被拒绝...)。实际上,我添加了发布回购,其中只有里程碑的存在并拒绝连接。 Sugg:检查需要哪个回购和/或从POM复制它们没有问题。
<repositories>
<repository>
<id>repo.springsource.org.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>https://repo.springsource.org/milestone</url>
</repository>
<repository> <!-- this one added -->
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
</repository>
</repositories>
答案 2 :(得分:0)
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<username>chenchu.madhiboina</username> <!-- LOG in username/Put your username here -->
<password>hari01</password> <!-- LOG in password/Put your password here -->
<host>xx.xx.xx.xx</host> <!-- Put the IP address of your proxy server here -->
<port>80</port> <!-- Put your proxy server's port number here -->
<nonProxyHosts>local.net|some.host.com</nonProxyHosts> <!-- Do not use this setting unless you know what you're doing. -->
</proxy>
答案 3 :(得分:0)
此错误是因为您在代理后面,并且maven无法下载所需的几个jar。在办公室网络中,我遇到了同样的错误。然后我尝试在家庭wifi中,错误不再存在。我没有按照以下步骤更改setting.xml 1.连接到没有任何代理或防火墙的网络 2.右键单击项目-> maven->更新项目