关于SpringBoot项目导入eclipse,pom文件的parent标签报错解决

时间:2024-04-12 19:59:16

最近研究SpringBoot框架,访问http://start.spring.io/,选择构建工具Maven Project等其他工程信息,Generate Project下载项目压缩包,解压后使用eclipse,Import - Existing Maven Projects 导入项目,但是出现pom文件parent标签报错:

Description	Resource	Path	Location	Type
Project build error: Non-resolvable parent POM for com.example.demo:wh-spring-boot:1.0.2-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.M7 from https://repo.spring.io/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of spring-snapshots has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.0.M7 from/to spring-snapshots (https://repo.spring.io/snapshot): Received fatal alert: protocol_version and 'parent.relativePath' points at no local POM	pom.xml	/wh-spring-boot	line 14	Maven pom Loading Problem

网上找到的解决方法是在maven的settings.xml中配置阿里的mirror,然后eclipse和maven分别update

windows-preference-maven-user settings-update settings-apply

windows-show view-other-maven-mavenrRepositories,在出现的localRepository右键rebuild index

再是对项目maven-update project。

但是并未解决,索性删除本地的maven仓库,然后maven install重新下载。install success之后pom文件的parent标签不再报错,出现新的错误:

org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)

网上搜索说是maven配置文件不是最新的,解决如下:

help-install new software-add-http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.2/N/LATEST/

装完之后又新的错:

web.xml is missing and <failOnMissingWebXml> is set to true

继续搜索,右击项目-Java EE Tools-Generate De...在webapp-WEB-INF下创建web.xml

解决

maven的settings.xml配置如下

关于SpringBoot项目导入eclipse,pom文件的parent标签报错解决

参考:https://blog.****.net/xhao327/article/details/84863757

https://blog.****.net/qq360452913/article/details/81636052

https://yq.aliyun.com/articles/643527

https://www.cnblogs.com/tangshengwei/p/6341462.html