使用VsCode安裝了Maven插件以后,在插件安裝目錄(C:\Users\用戶名\.vscode\extensions)下并不會(huì)存在配置文件settings.xml,因此無(wú)法直接通過(guò)編輯該文件配置Maven的倉(cāng)庫(kù)。
使用VsCode的設(shè)置,找到Maven的配置項(xiàng)Java.Configuration.Maven
在其中輸入你的settings.xml文件路徑(注意:如果是在WSL下,需要使用Linux系統(tǒng)文件路徑),settings.xml文件可以從安裝版的Maven目錄中拷貝一份,并修改其中倉(cāng)庫(kù)部分的配置內(nèi)容,配置完成后需要重啟VsCode。
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers></servers>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
<profiles></profiles>
</settings>