Maven 构建很慢及失败解决办法

85 阅读1分钟

maven 构建慢遇到的问题

1.maven 构建动不动就几个小时,能看到一直在下载东西,断断续续,动不动就几个小时甚至时间更长,很是头疼

2.甚至于你等了很久还是失败,如下

bcd7a41630cce749d2f2b0974890aaa.png

迫切需要一个解决办法,使用如下办法后,基本都能在3分钟内全部下载完

解决办法

一、使用国内镜像

第一个是依赖镜像,很多人都知道

第二个是插件镜像,比较冷门,我在这个上吃亏很多

<repositories>
    <repository>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>mirror-plugin</id>
        <url>https://maven.aliyun.com/repository/public</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

二、加大idea 中关于maven 的内存

image.png