简体   繁体   English

Maven默认本地存储库

[英]Maven default local repository

There is problem with local maven repository. 本地Maven存储库有问题。 I want to change maven and local repository path. 我想更改Maven和本地存储库路径。 I use Intellij and did it in setting->build,execution,deployment->maven, just changed here user settings file and local_repository then choose override and apply . 我使用Intellij并在setting-> build,execution,deployment-> maven中进行了此user settings file ,只是在这里更改了user settings filelocal_repository然后选择了overrideapply

If I put mvn install there is still default path ( /.m2/repository/ ). 如果我把mvn install仍然有默认路径( /.m2/repository/ )。 How is it possible do solve this problem? 如何解决这个问题?

Why don't you try to update the local repo path in the settings.xml inside 'conf' directory with a text editor? 为什么不尝试使用文本编辑器更新“ conf”目录下settings.xml中的本地存储库路径?

<localRepository>{your-new-path}</localRepository> <!-- goes inside the settings tag -->

Once done, make sure that the maven location pointed to by MAVEN_HOME and the settings file you have configured are one and the same. 完成后,确保MAVEN_HOME指向的Maven位置与您配置的设置文件相同。

Overrriding Local Repository preference in Intellij doesn't change the system-level settings. 在Intellij中重写本地存储库首选项不会更改系统级别的设置。 They only resonate well inside Intellij. 它们只能在Intellij内部产生良好的共鸣。 You will have to use Maven Projects view inside intellij and run the maven goals from there for this setting to take effect. 您必须在intellij中使用Maven Projects视图,然后从那里运行Maven目标,此设置才能生效。 If you run from inside a terminal, whether from inside Intellij or outside it, you will have to explicitly specify the loca repo as an argument to the command. 如果从终端内部运行,无论是从Intellij内部还是外部运行,都必须显式指定loca repo作为命令的参数。 Check this: Can I add maven repositories in the command line? 检查以下内容: 我可以在命令行中添加Maven存储库吗?

It looks like you have only changed the maven path and not the repository path. 看来您只更改了maven路径,而未更改存储库路径。

Your repository location is specified in the .m2/conf/settings.xml file. 您的存储库位置在.m2/conf/settings.xml文件中指定。 Once you change your MAVEN_HOME in your classpath to point to the right maven location, you should also change the repository location in the settings xml. 一旦将类路径中的MAVEN_HOME更改为指向正确的Maven位置,您还应该在设置xml中更改存储库的位置。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM