SpringBoot项目Maven引用报错:spring-boot-starter-parent:pom:1.5.2.RELEASE找不到的问题

饶谦
2023-12-01

一、问题的描述

Project build error: Non-resolvable parent POM for com.example:demo-1:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:1.5.2.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository

二、 尝试解决的办法

方法一、打开终端,进入项目的根目录,然后使用 maven bin 目录下的 mvn 编译命令编译一下(也就是mvn compile),完成之后右键项目 选择Maven,之后选择Update Project 。然而,测试结果表明问题没有解决;
方法二、maven的setting.xml 配置文件配置得不对,路径:E:\apache-maven-3.6.0-bin\apache-maven-3.6.0\conf\setting.xml,修改里面的部分内容如下,直接复制即可:

<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>

测试后,该问题成功解决!

 类似资料: