eclipse maven环境配置

下载Apache Maven

进入maven官网,下载

然后解压到文件夹中

复制路径,然后配置M2_HOME环境变量

然后在path中添加maven的bin路径

验证是否安装成功,在cmd中,执行 mvn –version

这样maven的环境就配置好了

之后,配置国内的maven下载源,在c:\Users\用户名\.m2中新建settings.xml,如果没有文件夹或者settings.xml就新建文件夹和settings.xml文件

打开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>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/repositories/central/</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>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>

这样,源就添加好了

猜你喜欢

转载自blog.csdn.net/qq_38551124/article/details/81084098