一、问题
搭建spark环境 , 创建Maven 新项目的时候,一直报错:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
二、原因
到maven目录(在eclipse的 window->Maven->user settings 可以看到) .m2\repository\org\apache\maven\plugins\maven-resources-plugin\2.6 下, 随机选择一个文件打开。。 发现有连接超时 应该是部分依赖jar 外网不能访问到。。
三、解决办法:
1. 配置Maven 代理
1.1 在目录.m2 下创建 settings.xml
1.2 settings.xml 添加下文(红色部分换为自己的外网代理和端口)
<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">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies>
<proxy>
<id>http</id>
<active>true</active>
<protocol>http</protocol>
<username></username>
<password></password>
<host>proxy.xxx</host>
<port>8080</port>
<nonProxyHosts>localhost:127.0.0.1</nonProxyHosts>
</proxy>
<proxy>
<id>https</id>
<active>true</active>
<protocol>https</protocol>
<username></username>
<password></password>
<host>proxy.xxx</host>
<port>8080</port>
<nonProxyHosts>localhost:127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings>
2、删除目录 .m2\repository\org\apache\maven\plugins
删了,再次创建。。会再重新下载。。
3、 再新建 Maven 项目
四、其他解决办法