第一种错误:
ArtifactTransferException: Failure to transfer com.google.collections:google-collections:jar:1.0 from http://repo1.maven.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 com.google.collections:google-collections:jar:1.0 from/to central (http://repo1.maven.org/maven2):
No response received after 60000
第二种错误:
Execution default-testResources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources failed: Unable to load
the mojo 'testResources' in the plugin 'org.apache.maven.plugins:maven-resources-plugin:2.4.3'. A required class is missing: Lorg/sonatype/
plexus/build/incremental/BuildContext; ----------------------------------------------------- realm = plugin>org.apache.maven.plugins:maven-
resources-plugin:2.4.3 strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy urls[0] = file:/D:/maven/repository/org/apache/
maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.jar urls[1] = file:/D:/maven/repository/org/apache/maven/
reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar urls[2] = file:/D:/maven/repository/org/apache/maven/doxia/doxia-sink-api/
1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar urls[3] = file:/D:/maven/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar urls[4] = file:/
D:/maven/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar urls[5] = file:/D:/maven/
repository/junit/junit/3.8.1/junit-3.8.1.jar urls[6] = file:/D:/maven/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar u
如图:
这两个错误的原因是本工程依赖的包 在本地仓库中存在,曾经下载中超时或者未下载成功。
Maven不管下没下成功,都会有一个.lastupdate文件,一旦出现了这个文件,而你指定远程仓库的方式是mirror,而不是profile里的repository,那么Maven默认不会去更新这个文件
解决方法两个步骤:
1.找到自己的本地仓库,(有关本地仓库详见:Maven本地仓库路径修改),默认的路径在本地用户的临时文件夹下面的 .m2 文件夹下的 repository 下,例如:C:\Users\joe\.m2\repository 把repository下的文件夹全部删除,或者只把相关报错的包的目录删除
2. MyEclipse --> Preferences -->Maven4MyEclipse ---> User Settings
点击按钮 Update Settings 和 点击 Reindex按钮
刷新项目,应该就没有报错信息了,如果还有,试试重启MyEclipse再刷新项目
本文地址:http://www.45fan.com/dnjc/100201.html