idea 修改maven setting文件不生效解决方案

原因

idea 中的maven 配置的自定义 XXX_settings.xml 文件 会与 MAVEN_HOME/conf 中的 settings.xml 文件整合。

方案

1.直接修改 MAVEN_HOME/conf/settings.xml

2.如果需要自定义,先将 MAVEN_HOME/conf/settings.xml 中的 <mirrors> 中的 <mirrorOf> 的 * 去了

  mirrorOf=“*”时镜像所有的repositoryId,包括repositories和pluginRepositories。如果你需要某个jar就会从镜像mirrorOd配置的地址去下载这个jar。其他配置的repostory都没用

 

 

默认settings.xml 注释:

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->

优先级 user level > global level

user level path: ${user.home}/.m2/settings.xml

global level path:${maven.conf}/settings.xml.

这两个路径可能存在 setting 配置文件,注意调整

posted @   MonkeyJesus  阅读(3275)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!
点击右上角即可分享
微信分享提示