问题:
最近在Eclipse中使用Maven的时候出现如下错误;
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.taotao:taotao-manager:0.0.1-SNAPSHOT (C:\Users\qq\Desktop\taotao\taotao-manager\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not find artifact com.taotao:taotao-parent:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 4, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
原因:
在子模块中找不到父模块的pom.xml及相关依赖。<parent>元素的属性:<relativePath>: 表示父模块POM的相对路径,在构建的时候,Maven会先根据relativePath检查父POM,如果找不到,再从本地仓库查找。
解决办法:
配置relativePath
<parent>
<groupId>com.taotao</groupId>
<artifactId>taotao-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../taotao-parent/pom.xml</relativePath>
</parent>