解决Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT问题

最近我在研究学习 Springboot,它在百度的搜索指数也直线上升,为了我的未来,因此我下了很大的功夫来学习的。在学习的过程中遇到了很多实际问题,本文将分享一个在使用 Springboot 时遇到的问题。

我从 Springboot 的官网:http://start.spring.io/ 构建了一个 Springboot 项目。

步骤如下:

  1. 访问http://start.spring.io/

  2. 选择构建工具Maven Project、Spring Boot版本1.3.6以及一些工程基本信息,点击“Switch to the full version.”java版本选择1.7,可参考下图所示:

    Springboot 构建项目

  3. 点击Generate Project下载项目压缩包

  4. 解压后,使用eclipse,Import -> Existing Maven Projects -> Next ->选择解压后的文件夹-> Finsh,OK done!

导入项目后,找到 main 方法进行运行,结果报了下面的异常:

Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT: Failure to find org.springframework.boot:spring-boot-starter-parent:pom:1.5.8.RELEASE in maven.tedu.cn/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced and 'parent.relativePath' points at no local POM

根据问题的提示,我们可以看出是在仓库中查找 spring-boot-starter-parent 失败导致的。

那么为什么会失败呢?很可能是你的 setting.xml 配置文件配置的不对。改成下面的配置即可解决这类问题:

<?xml version="1.0" encoding="UTF-8"?>
<!-- :www.xttblog.com -->
<settings>
    <localRepository>D:/Common Files/maven/repository</localRepository>
    <interactiveMode>true</interactiveMode>
    <offline>false</offline>
	<mirrors>
		<mirror>  
			  <id>repo2</id>  
			  <mirrorOf>central</mirrorOf>  
			  <name>spring2.0 for this Mirror.</name>  
			  <url>https://repo.spring.io/libs-milestone</url>  
		</mirror>  
		<mirror>  
		  <id>net-cn</id>  
		  <mirrorOf>central</mirrorOf>  
		  <name>Human Readable Name for this Mirror.</name>  
		  <url>http://maven.net.cn/content/groups/public/</url>   
		</mirror>  
		<mirror>  
			  <id>ui</id>  
	
		  <mirrorOf>central</mirrorOf>  
			  <name>Human Readable Name for this Mirror.</name>  
			 <url>http://uk.maven.org/maven2/</url>  
		</mirror>  
		<mirror>  
		  <id>ibiblio</id>  
		  <mirrorOf>central</mirrorOf>  
		  <name>Human Readable Name for this Mirror.</name>  
		 <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>  
		</mirror>  
		<mirror>  
			  <id>jboss-public-repository-group</id>  
			  <mirrorOf>central</mirrorOf>  
			  <name>JBoss Public Repository Group</name>  
			 <url>http://repository.jboss.org/nexus/content/groups/public</url>  
		</mirror>
	</mirrors>
	<profiles>
		<profile>
			<id>neo</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<jdk>1.8</jdk>
			</activation>
			<repositories>
					<repository>
						<id>spring-milestones</id>
						<name>Spring Milestones</name>
						<url>https://repo.spring.io/libs-milestone</url>
						<snapshots>
							<enabled>false</enabled>
						</snapshots>
					</repository>
			</repositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>neo</activeProfile>		
	</activeProfiles>
</settings>

如果问题还没有解决,欢迎留言或关注我的微信公众号进行反馈!

解决Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT问题

: » 解决Project build error: Non-resolvable parent POM for com.example:demo:0.0.1-SNAPSHOT问题

原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/251716.html

(0)
上一篇 2022年5月3日
下一篇 2022年5月3日

相关推荐

发表回复

登录后才能评论