Idea 新建springboot项目 spring-boot-starter-parent 包maven依赖报错

版权声明:需要转载的朋友下面留个言 https://blog.csdn.net/weixin_42955598/article/details/83578573

今天使用Idea导入spring-boot 项目时 maven 报错

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.15.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

然后感觉就是自己maven镜像里面搜不到这个包,所以找到maven的setting.xml 修改镜像 之后update poject 项目就开始下载pom.xml中的jar包啦

setting.xml 修改前

  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     
  </mirrors>

修改后

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
    
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
     <id>mirrorId</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://central.maven.org/maven2/</url>
       </mirror>
  </mirrors>

具体为添加镜像

	 <mirror>
     <id>mirrorId</id>
      <mirrorOf>central</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://central.maven.org/maven2/</url>
       </mirror>
 

猜你喜欢

转载自blog.csdn.net/weixin_42955598/article/details/83578573