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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

码农波哥   2021-04-16 我要评论
想了解解决IDEA springboot"spring-boot-maven-plugin"报红问题的相关内容吗,码农波哥在本文为您仔细讲解spring-boot-maven-plugin报红的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:spring-boot-maven-plugin报红,spring,boot,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中看到,从阿里云提供的地址下载,速度比中央仓库快

<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

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们