从一台Fedora的电脑中拷过来一个project,在win10的Eclipse下选择Import->Existing Maven Projects,载入时却出现以下错误:
org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 () (org.apache.maven.plugins:maven-resources-plugin:2.6:resources:default-resources:process-resources)
这里提示的是Maven的maven-resources-plugin插件载入失败,进入C:\Users\yourname\.m2\repository\org\apache\maven\plugins文件下,找到maven-resources-plugin文件,缺失maven-resources-plugin.jar文件,于是笨拙地去官网下载了一个,刷新projet,重启Eclipse还是出现这样的错误。
在stackoverflow上找到了类似问题的解决方案,类似的,出现maven-compiler-plugin,maven-deploy-plugin,maven-clean-plugin等插件提示错误的,都可以遵循以下原则解决
1.清空C:\Users\yourname\.m2\repository 文件夹
2.右键此projet,Maven->Update projects,快捷键为Alt+F5,此步会重新生成respository文件夹,里边的插件自然会从官网自动下 载
3.关闭Eclipse,执行maven install
- install:install is used to automatically install the project's main artifact (the JAR, WAR or EAR), its POM and any attached artifacts (sources, javadoc, etc) produced by a particular project.
4.再次打开Eclipse,projec可以正常工作啦