创建maven项目后Plugins爆红解决方法

创建maven项目后Plugins爆红,如下图所示

 

大概率为conf文件夹下settings.xml配置不正确

可从以下几个方面先进行检查:

  • 如果在公司需要使用代理上网,则首先要在settings.xml中的<proxies></proxies>添加代理设置
 <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>你的用户名</username>
      <password>你的密码</password>
      <host>你的代理ip</host>
      <port>你的端口</port>
    </proxy>
  </proxies>
  • 是否进行了镜像配置,如果没有配置,则需要在settings.xml中的<mirrors></mirrors>中添加国内阿里云的镜像
<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
  <!--阿里云的镜像-->
        <mirror>
            <id>alimaven</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
   <!--中央仓库在中国的位置-->
   <mirror>
    <id> maven-net-cn</id>
    <name> Maven China Mirror</name>
    <url> http://maven.net.cn/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
   </mirror>
 </mirrors>
  • 是否在IDEA设置中的配置了Maven,一定注意要将settings.xml所在的位置进行覆盖设置,如下图所示,操作步骤:Maven>设置User settings file>勾选Override>Apply>OK

配置完成后保存,再到项目去测试是否解决了问题,例如org.apache.maven.plugins:maven-compiler-plugin:3.1,则先到Lifecycle中找到对应的compiler,双击运行

运行后,如果显示了BUILD SUCCESS,则表示对应的Plugins下载成功

下载成功后,右击项目,点击Reimport,则爆红会消失

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值