之前还好好的,今天打开后,就报了很多错误,而且都类似,如下:
(1)ArtifactDescriptorException: Failed to read artifact descriptor for log4j:log4j:jar:1.2.17: ArtifactResolutionException: Failure to transfer log4j:log4j:pom:1.2.17 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 log4j:log4j:pom:1.2.17 from/to central (http://repo1.maven.org/maven2): The operation was cancelled. pom.xml /face line 1 Maven Dependency Problem
(2)ArtifactTransferException: Could not transfer artifact com.baidu.aip:java-sdk:jar:4.5.0 from/to central (http://repo1.maven.org/maven2): Write error pom.xml /face line 22 Maven Dependency Problem
(3)ArtifactTransferException: Could not transfer artifact org.json:json:jar:20160810 from/to central (http://repo1.maven.org/maven2): invalid version format: 1 pom.xml /face line 1 Maven Dependency Problem
查了一下,发现,原来由于网络等原因,相应的jar包没有抓下来,生成了很多 *.lastUpdated 为后缀的文件,以于是根据报错提示,来到本地仓库中,找到报错的文件,点进去后发现真的没有jar包,只有 *lastUpdated 为后缀的文件,删了之后,果然错误减少了不少,但却变成了第一行报错:
ArtifactTransferException: Could not transfer artifact org.json:json:jar:20160810 from/to central (http://repo1.maven.org/maven2): invalid version format: 1 pom.xml /face line 1 Maven Dependency Problem
这是由于其他地方也有 *lastUpdated 为后缀的文件,一个一个删不科学,只需在cmd下,进入到本地仓库的目录中,执行此命令,复制粘贴即可:`for /r %i in (*.lastUpdated) do del %i ` 它会自动删除一切 *lastUpdated 为后缀的文件 然后,更新maven项目,如图,我在myeclipse更新我的maven项目后,错误全部消除 ![这里写图片描述](https://img-blog.csdn.net/20180905203213274?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2xlZ2VuZGFyeWhhaGE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70) 最新发现:下面这个异常也是上述原因造成,删除 *lastUpdated 的文件后,更新项目,如上图所示,如果有报错没有更新配置,则再更新项目配置,就在update dependencies下面。 ``` CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: ```