• 新装maven建的第一个项目报错,下载失败


    问题

    错误大概如下,就是无法下载jar包

    [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolve..
    

    尝试了以下方法:

    • 删除这个目录下的C:UsersAdministrator.m2 epository(你自己的目录)所有文件,没用

    • setting.xml里面换成阿里源,没用

    • 直接在pom.xml加上阿里源,没用

    <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>https://maven.aliyun.com/repository/central/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    

    解决

    最后,在这里找到了解决办法

    1.首先要知道,IDEA是自带maven的,这里不用它自带,改成我们自己的,首先要去maven官网下载,然后配置环境变量,然后再IDEA里面修改一下配置,如下图,修改红框中的地方,改成自己的maven路径

    image.png

    2.然后修改一下setting.xml里面的镜像,方便后面下的更快

    <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>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>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>
    </mirrors>
    

    3.最关键的一步,之前下载失败问题都出在这里,看图操作

    image.png

    如上图所示进入Maven->Runner 然后将下面内容复制粘贴到VM Options当中保存即可。

    -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
    
  • 相关阅读:
    python ipython使用
    Django ORM 操作
    Django uwsgi 基础知识
    前端 vue router 传递参数
    观察者模式和发布订阅模式
    关于重绘和回流
    Vuex入门简单示例(五)
    Vuex入门简单示例(四)
    Vuex入门简单示例(三)
    Vuex入门简单示例(二)
  • 原文地址:https://www.cnblogs.com/harrylyx/p/12882457.html
Copyright © 2020-2023  润新知