如何在 Windows 中更改 Maven 存储库文件夹? [英] How to change maven repository folder in windows?
问题描述
在 Windows 中,maven 下载 C:\Documents And Settings\MyUser\.m2
文件夹(或 C:\Users\MyUser\.m2
)中的所有内容.有没有办法改变它使用的文件夹?特别是我想将它设置为在 Documents And Settings
/Users
文件夹中的任何位置下载.
In windows, maven downloads everything in the C:\Documents And Settings\MyUser\.m2
folder (or C:\Users\MyUser\.m2
). There exists some way to change the folder that it uses? Specially I want to set it to download anywhere BUT in the Documents And Settings
/Users
folder.
推荐答案
查看 ${maven.home}/conf
中的 settings.xml
或者,最好是,${user.home}/.m2/settings.xml
(见this 有关 settings.xml
的详细信息).您可以添加(或取消注释)以下部分:
Look at your settings.xml
in ${maven.home}/conf
or, preferrably, ${user.home}/.m2/settings.xml
(see this for details about the settings.xml
). You can add (or uncomment) the following section:
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
-->
<localRepository>/path/to/local/repo</localRepository>
正如默认情况下已注释掉的部分所建议的那样.在那里,您应该能够更改路径以实现您想要的目标.
as suggested by the commented out section already there by default. There, you should be able to change the path to achieve what you want.
这篇关于如何在 Windows 中更改 Maven 存储库文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!