【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,问题解决。

相关推荐
Dicky-_-zhang15 分钟前
容器网络CNI实战:从零搭建网络插件
java·jvm
Mahir0816 分钟前
Spring 事务深度解析:核心原理与 12 种事务失效场景全解
java·spring·面试·事务失效
SL_staff19 分钟前
从Zoom/腾讯会议迁移到私有化会议系统:数据迁移完整方案
java·架构
笨蛋不要掉眼泪20 分钟前
Java并发编程:内存可见性与synchronized同步机制
java·开发语言·并发
用户39599249400621 分钟前
Java开发者接入大模型API实战:从0到聊天机器人
java
JAVA面经实录91732 分钟前
Java 多线程完整版学习文档(无遗漏终版)
java·面试
考虑考虑36 分钟前
JDK26中的LazyConstant
java·后端·java ee
Devin~Y38 分钟前
互联网大厂 Java 面试实录:JVM、Spring Boot、MyBatis、Redis、Kafka、Spring AI、K8s 全链路追问小Y
java·jvm·spring boot·redis·kafka·mybatis·spring security
摇滚侠40 分钟前
SpringCloud 面试题 真正的 offer 偏方 Java 基础 Java 高级
java·spring·spring cloud
tongluowan0071 小时前
Java 内存模型(JMM)- happens-before 与内存屏障
java·内存模型·happens-before