解决:IDEA创建SpringBoot项目时无法导入依赖问题

解决:IDEA创建SpringBoot项目时无法导入依赖问题

1、问题

在创建SringBoot项目时候,无法正常导入依赖的jar包,错误显示如下:
“Project ‘org.springframework.boot:spring-boot-starter-parent:2.0.0.RELEASE’ not fond more…”
在这里插入图片描述

 <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.0.0.RELEASEversion>
        <relativePath/>
    parent>
    
    <dependencies>
    <dependency>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-webartifactId>
    dependency>

2、 摸索思考

记得之前上课的时候用Eclipse 也有类似的问题 解决办法就是将版本降级,只有降级了,才能兼容当前使用工具或者JDK版本的一个环境, 但是尝试修改过后并没有什么卵用
查找网上类似文章解决办法说要添加maven的镜像,打开maven的setting.xml修改过后如下:

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

修改过后
依旧没有解决。

3、问题解决

多番摸索,尝试过后,无果,决定重置整个setting文件,把添加的镜像改成阿里的,成功,正确代码如下:

...
  <profile>
        <id>jdk-1.8id>
        <activation>
            <activeByDefault>trueactiveByDefault>
            <jdk>1.8jdk>
        activation>
        <properties>
            <maven.compiler.source>1.8maven.compiler.source>
            <maven.compiler.target>1.8maven.compiler.target>
            <maven.compiler.compilerVersion>1.8maven.compiler.compilerVersion>
        properties>
    profile>
 <mirrors>
      <mirror>
          <id>alimavenid>
          <name>aliyun mavenname>
            <url>http://maven.aliyun.com/nexus/content/groups/public/url>
          <mirrorOf>centralmirrorOf>
      mirror>
  mirrors>
  ...

成功自动导入jar包!是开心的哈哈哈
解决:IDEA创建SpringBoot项目时无法导入依赖问题_第1张图片

你可能感兴趣的:(问题解决,Java)