[英]How to change maven repository folder in windows?
在 Windows 中,maven 下載C:\\Documents And Settings\\MyUser\\.m2
文件夾(或C:\\Users\\MyUser\\.m2
)中的所有內容。 有沒有辦法改變它使用的文件夾? 特別是我想將它設置為在Documents And Settings
/ Users
文件夾中的任何位置下載。
查看${maven.home}/conf
中的settings.xml
,或者最好是${user.home}/.m2/settings.xml
(有關settings.xml
詳細信息,請參閱此內容)。 您可以添加(或取消注釋)以下部分:
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
-->
<localRepository>/path/to/local/repo</localRepository>
正如默認情況下已經存在的注釋掉部分所建議的那樣。 在那里,您應該能夠更改路徑以實現您想要的目標。
對於 Eclipse IDE
如果您使用本地 Maven 作為 Eclispe 中 M2 插件中的 Maven 安裝,編輯 settings.xml 對我來說還不夠。 該插件仍然使用默認的 {user.home}/.m2 作為存儲庫位置。
我必須轉到: Windows > Preferences > Maven > User Settings
並在全局設置和/或用戶設置輸入字段中指向我本地 Maven 的 settings.xml 文件。 然后單擊應用將開始在正確的目的地存儲工件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.