解决方法:修改代理。
1.打开%MAVEN_HOME%\conf\setting,xml文件,%MAVEN_HOME%是安装目录。
2.修改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>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
参考博客:https://blog.csdn.net/wl950101/article/details/80898267