1. File -> setting ,然後在搜索框中搜索maven,如下圖所示
2. 在本地中打開紅框圈起來的目錄,如果目錄下沒有settings.xml,就自己新建一個,然後將如下內容粘貼到這個文件中。
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
然後保存退出,之後IDEA會彈出來一個提示:import change,再點一下這個就可以了。