【idea】解决sprintboot项目创建遇到的问题2

本篇是继【idea】解决sprintboot项目创建遇到的问题_java.lang.illegalargumentexception: unable to inst-CSDN博客

目录

[一、Dependency 'com.mysql:mysql-connector-j:' not found](#一、Dependency 'com.mysql:mysql-connector-j:' not found)

[二、Could not find artifact org.springframework.boot:spring-boot-maven-plugin:pom:4.0.0 in alimaven (http://maven.aliyun.com/nexus/content/groups/public/)](#二、Could not find artifact org.springframework.boot:spring-boot-maven-plugin:pom:4.0.0 in alimaven (http://maven.aliyun.com/nexus/content/groups/public/))


一、Dependency 'com.mysql:mysql-connector-j:' not found

报错:在创建新的springboot项目时碰到

原因:说明在该新建的项目中没有导入下列依赖。

解决方法:

有时候maven下载依赖特别慢,是因为没有修改maven镜像,导致本地库中没有的时候,会默认从国外网站下载。现进行修改。

找到本地maven安装路径,进入conf目录,打开settings.xml文件,

打开"settings.xml"文件,找到"mirrors"节点,输入如下图代码。将镜像路径配置成阿里云镜像,

复制代码
     <mirror>
      <id>alimaven</id>
      <mirrorOf>central</mirrorOf>  
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>

回到idea中,重新选择一下maven的settings.xml文件,

重启idea。下载maven依赖就变快了。

OK,问题解决。

二、Could not find artifact org.springframework.boot:spring-boot-maven-plugin:pom:4.0.0 in alimaven (http://maven.aliyun.com/nexus/content/groups/public/)

报错:pom.xml 文件的配置情况,如下所示:

<plugin>标签下,可以发现org.springframework.boot没问题,但是<artifactId>的spring-boot-maven-plugin提示有问题。

原因:无法识别使用哪个版本的 spring-boot-maven-plugin 包。

解决方法:crtl+单击上面的org.springframework.boot会跳转到配置文件中,找到spring-boot-maven-plugin的版本信息,也就是<version>,复制到标错的那行下边,

复制代码
<version>4.0.0</version>

但是刷新之后,发现还是报错。

打开Maven的安装目录路径下,可以发现本地的maven仓库中存在多个版本的 spring-boot-maven-plugin 包,如下所示:

使用 <version> 标签添加版本号,如下所示,

OK,问题解决。

相关推荐
Java面试题总结2 分钟前
Spring AI 初步集成(2)-添加记忆
java·人工智能·spring
野犬寒鸦2 分钟前
JVM垃圾回收机制深度解析(G1篇)(垃圾回收过程及专业名词详解)
java·服务器·jvm·后端·面试
清水白石0083 分钟前
协程不是线程:深入理解 Python async/await 运行机制
java·linux·python
程序员老乔3 分钟前
Java 新纪元 — JDK 25 + Spring Boot 4 全栈实战(五):FFM API,告别JNI在Spring Boot中直连推荐引擎
java·开发语言·spring boot
va学弟4 分钟前
Java 网络通信编程(7):完善视频通信
java·服务器·网络
后青春期的诗go5 分钟前
泛微OA-E9与第三方系统集成开发企业级实战记录(九)
java·金蝶·erp·泛微·oa·集成开发·e9
逸Y 仙X10 分钟前
文章十:ElasticSearch索引字段高级属性
java·大数据·elasticsearch·搜索引擎·全文检索
就叫飞六吧12 分钟前
Tomcat /hvm类加载机制
java·笔记
共享家952715 分钟前
Java入门( 日期类与 BigDecimal 工具类 )
java·开发语言
好好学习叭~21 分钟前
正则表达式
java·开发语言