软件编程
位置:首页>> 软件编程>> java编程>> 解决IDEA springboot"spring-boot-maven-plugin"报红问题

解决IDEA springboot"spring-boot-maven-plugin"报红问题

作者:码农波哥  发布时间:2023-08-15 21:29:19 

标签:springboot,maven,plugin,报红

使用环境

项目环境: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中看到,从阿里云提供的地址下载,速度比中央仓库快

解决IDEA springboot"spring-boot-maven-plugin"报红问题


<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文件

解决IDEA springboot"spring-boot-maven-plugin"报红问题


<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

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com