在 Trae 中设置 Maven 仓库,本质上是配置 Trae 的 settings.xml 路径,在setting文件中配置trae使用maven的路径,包括:
- 本地仓库地址(
<localRepository>) - 镜像仓库地址(如阿里云)
- JDK 版本与 Maven 路径
✅ Trae 中设置 Maven 仓库的完整步骤如下:
🔧 1. 打开 Trae 设置文件 settings.json
使用快捷键:
Ctrl + Shift + P → 输入 "Preferences: Open Settings (JSON)"
🧩 2. 添加以下 Maven 配置项
{
"maven.settingsFile": "I:\\work\\tool\\maven\\apache-maven-3.9.10\\conf\\settings.xml",
"maven.executable.path": "I:\\work\\tool\\maven\\apache-maven-3.9.10\\bin\\mvn.cmd",
"maven.executable.preferMavenWrapper": false,
"java.configuration.maven.userSettings": "I:\\work\\tool\\maven\\apache-maven-3.9.10\\conf\\settings.xml",
"java.configuration.maven.globalSettings": "I:\\work\\tool\\maven\\apache-maven-3.9.10\\conf\\settings.xml"
}
⚠️ 注意:路径请根据你本地的 Maven 安装路径修改。同时注意符号的正确性。