search

Home  >  Q&A  >  body text

java - 如何让maven优先使用用户setting.xml的配置?

黄舟黄舟2802 days ago580

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-18 10:48:49

    It is settings.xml not setting.xml, so your user configuration does not take effect

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 10:48:49

    Are you using maven in combination with the IDE or alone? Maybe your settings in the IDE have not been changed

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 10:48:49

    @FullStackDeveloper You are right. The setting.xml in the question is written incorrectly. I actually have settings.xml in the directory. Because I copied the file in the compressed package, the file name is not wrong. Thank you very much for reminding.

    @Ruoxi Xiangyan is used in IDEA. Which configuration file is used can be independently configured in IDEA. If not selected, user configuration takes priority by default.

    Finally, I found the cause of the problem as follows:
    Use the command mvn help:system directly in the terminal to observe the reading of the configuration.
    %USERPROFILE% points to the user directory under the C drive, but I accidentally discovered that there is also a user directory under the D drive, and there is also an .m2 directory in this user directory. I thought I was going to the user directory under the C drive, but actually I was going to the user directory under the D drive.
    So no matter how I modify the configuration under C drive, it has no effect.

    reply
    0
  • Cancelreply