java

关注公众号 jb51net

关闭
首页 > 软件编程 > java > Maven Plugins报错的解决

Maven Plugins报错的正确解决方案

作者:GaoSSR

文章介绍了如何解决Maven插件报错的问题,建议在本地Maven仓库目录中删除报错的插件文件,然后在IDEA中刷新Maven以重新加载,同时,作者还提到了一个无效的方法,即通过修改Maven的setting.xml文件添加镜像源

背景

正确解决之道

在自己本地Maven的安装目录中找到自己的仓库地址目录:直接搜索自己报错的插件文件,把它们删除,

如图:

接着回到IDEA点击Maven刷新按钮重新加载即可:已解决

反例:即没什么卵用的方法(MySelf踩坑的经历)

找到Maven的setting.xml文件,找到<mirrors>标签,多补充几个镜像源:

 <!-- 阿里镜像 -->
    <mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
    </mirror>
  
    <mirror>
        <id>central</id>
        <name>Maven Repository Switchboard</name>
        <url>http://repo1.maven.org/maven2/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>

    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>

    <mirror>
        <id>ibiblio</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
    </mirror>

    <mirror>
        <id>jboss-public-repository-group</id>
        <mirrorOf>central</mirrorOf>
        <name>JBoss Public Repository Group</name>
        <url>http://repository.jboss.org/nexus/content/groups/public</url>
    </mirror>

    <mirror>
        <id>google-maven-central</id>
        <name>Google Maven Central</name>
        <url>https://maven-central.storage.googleapis.com
        </url>
        <mirrorOf>central</mirrorOf>
    </mirror>
    
    <!-- 中央仓库在中国的镜像 -->
    <mirror>
        <id>maven.net.cn</id>
        <name>oneof the central mirrors in china</name>
        <url>http://maven.net.cn/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文