maven常见错误

【错误1】 org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM: Could not find artifact com.jxn.parent:jxn-parent:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 4, column 10 解析: 无法解析父级的POM文件。 说明: 当设置了<parent/>时,是需要有一个relative path来查找父项目的pom.xml的,而如果没有,那么默认的父项目pom.xml就在该pom.xml的父附录中。如果没有,就会根据groupId和artifactId在本地和远端maven仓库中找。

解决方法:
	方法一:由<relativePath>../../pom.xml</relativePath>指定正确的父pom路径,默认为../pom.xml
	方法二:将父项目安装到本地仓库中:选中父项目,右键选择Run As -- Maven install

【错误2】 Project build error 分析:更新的jar包中,缺少这个包,重新加载一次:

解决方案:
	1)选中项目,先project----->clean一下
	2)选中项目,Debug AS ----->maven clean
	3)加载pom里的jar,Debug AS------>maven INSTALL

【错误3】 从SVN上检出的pom.xml文件报错。 Could not calculate build plan:xxx or its dependencies could not be resolved: Failed to read artifact descriptor for xxx.jar

或者报 Cannot resolve symbol 'ClassName'(无法解析某一个类) 的错误。


分析:
	由于网络原因没有将Maven的依赖下载完整,出现了*.lastUpdate文件,导致无法重新下载完整的依赖。
	
解决方案:
	1)删除所有以.lastUpdate结尾的文件
		a)切换到maven的本地仓库(D:\repository)
		b)在当前目录打开cmd命令行
		c)执行命令:for /r %i in (*.lastUpdated) do del %i
	2)在项目上执行 Maven Update

补充:如果从网络上下载jar包比较慢,则可以考虑使用开源中国的私服:http://maven.oschina.net/help.html 来下载。

猜你喜欢

转载自my.oschina.net/u/1399755/blog/1650248