解决IDEA springboot"spring-boot-maven-plugin"报红问题
作者:码农波哥 时间:2023-08-15 21:29:19
使用环境
项目环境:Idea 2020.2.3、 Maven 3.6.3 、springboot 2.1.4
本人在创建springboot项目时spring-boot-maven-plugin 及Idea右侧Plugins划红,导致项目启动打包有问题。虽然项目能跑,但是后续开发中可能会出现不可预知的问题。太碍眼决定把它解决掉。
可能原因:
1、maven没有刷新;
2、Maven插件下载速度太慢,从国外的中央仓库下载;
3、也有可能是本地springboot版本问题等....
分析思路:
1、到仓库中发现有这插件,然后clean install 以后reimport还是飘红。
2、那我们找到Maven地址中的setting.xml中的mirrors标签添加以下内容,maven再次下载jar包时,idea中看到,从阿里云提供的地址下载,速度比中央仓库快
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\xxx\.m2\repository</localRepository> <!--这个地方改成自己本地路径-->
<interactiveMode/>
<offline/>
<pluginGroups/>
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo1.maven.org</id>
<name>Repo1 Maven of https://repo1.maven.org/maven2/</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!--
-->
</mirrors>
<proxies/>
<profiles>
<profile>
<id>downloadSources</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>downloadSources</activeProfile>
</activeProfiles>
</settings>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
但是以上两个方法依然没有解决,因为项目都是其它同事一直能跑起来过的,那就说明程序肯定没问题。主要我之前也是跑得好好的,也就换了一下系统,Idea版本也安装到2020.2.3 版本而已,到此心里感觉到了崩溃的边缘,只想说这是为什么......
然后实在找不到问题所在 ,最后试着改了改pom.xml文件
<version>2.2.2.RELEASE</version>
居然和版本有关系,问题就解决了。
有的网友说检查maven仓库地址,将改为C:\Users\xxx\.m2\repository,默认地址。大家也可以试试。这种问题可能还是本地版本不太对应导致,希望能帮助到大家。
也可以能有其他的问题,这方法不一定完全适应,仅供参考
如果大家有遇到Java-springboot的问题都可以加QQ群进行交流:Java技术交流群:554101646
来源:https://www.cnblogs.com/angelasp/archive/2021/04/16/14666037.html
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
idea mybatis配置log4j打印sql语句的示例
学生视角看Java 面向对象的继承本质
![](https://img.aspxhome.com/file/2023/0/59740_0s.png)
Java 手写LRU缓存淘汰算法
![](https://img.aspxhome.com/file/2023/0/64100_0s.jpg)
C#泛型方法在lua中表示的一种设计详解
Android可配置透明度的水印
![](https://img.aspxhome.com/file/2023/1/89551_0s.png)
java实现秒表功能
![](https://img.aspxhome.com/file/2023/7/80877_0s.jpg)
SpringBoot异步任务使用方法详解
![](https://img.aspxhome.com/file/2023/4/70964_0s.png)
SpringCloud Feign转发请求头(防止session失效)的解决方案
简单实现Android倒计时效果
![](https://img.aspxhome.com/file/2023/0/137950_0s.jpg)
java volatile关键字的含义详细介绍
![](https://img.aspxhome.com/file/2023/9/132029_0s.jpg)
Android使用线程获取网络图片的方法
Android AlertDialog(对话框)实例详解
![](https://img.aspxhome.com/file/2023/6/126776_0s.jpg)
file.mkdir()、file.mkdirs()和file.createNewFile()的区别
![](https://img.aspxhome.com/file/2023/0/92720_0s.png)
MyBatis Generator去掉生成的注解
Java四种常用线程池的详细介绍
Collections.shuffle()方法实例解析
C#将Sql数据保存到Excel文件中的方法
Android编程解析XML方法详解(SAX,DOM与PULL)
![](https://img.aspxhome.com/file/2023/4/106034_0s.png)
java利用jacob将word转pdf
![](https://img.aspxhome.com/file/2023/0/75510_0s.jpg)
Java面试题冲刺第二十五天--并发编程3
![](https://img.aspxhome.com/file/2023/9/58299_0s.png)