如何解决Maven-不可解析的父POM
我正在尝试使用Eclipse的Maven进行构建,即使从命令行运行它也无法正常工作。在Eclipse中,我使用相同的settings.xml,相同的Maven和相同的JRE。
日志如下:
[INFO] Scanning for projects...
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/()
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'version' contains an expression but should be a constant. @ line 8,column 11
[FATAL] Non-resolvable parent POM for (project name): Could not find artifact (artifact name):pom:1.0.3 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 18,column 10
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (project name):${project.version} (My pom.xml's full path) has 1 error
[ERROR] Non-resolvable parent POM for (project name):${project.version}: Could not find artifact (artifact name):pom:1.0.3 in central (https://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 18,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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
它丢失了项目的pom.xml的父pom,该父pom存储在工件中。我可以使用人工制品。
- 人工制品在
.m2/settings.xml
中声明
- 我可以在
.m2/repository
目录中找到它 - 我正在使用
JRE 1.8
- 我正在使用
Maven 3.6.0
清理项目并更新Maven不起作用。
解决方法
问题出在settings.xml
上。在Eclipse中,Maven使用两个设置:全局和本地设置,可以在以下位置设置
首选项-> Maven->用户设置
Global Settings
应该是安装Maven /conf/settings.xml的位置,而User Settings
应该是用户目录/.m2/settings.xml
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。