适用于Linux和Windows的Maven本地存储库位置 [英] Maven local repository location for Linux and Windows
问题描述
我有一个使用Windows和Linux的双启动系统.我有一个对Windows和Linux都可见的分区.我想将我的本地存储库放在那里.如何提供Linux和Windows都可以理解的路径. Windows将其视为d:/repository
驱动器,而Linux将其视为/media/234242342/repository
.我应该如何在pom.xml
中配置它?
I have a dual boot system with Windows and Linux. I have another partition which is visible to both Windows and Linux. I want to put my local repository there. How can I provide a path that both Linux and Windows will understand. Windows see it as d:/repository
drive and Linux sees it as /media/234242342/repository
. How should I configure this in pom.xml
?
推荐答案
根据Maven文档,每个操作系统都需要一个M2_HOME
.在$M2_HOME/conf/
内部,您可以放置 settings.xml
文件,并可以为以下文件指定位置使用<localRepository/>
元素的本地存储库.
Each OS needs an M2_HOME
as per the Maven documentation. Inside $M2_HOME/conf/
you can put a settings.xml
file and in that you can specify the location for the local repository using the <localRepository/>
element.
因此对于您的特定系统,在Windows中使用
So for your specific system, in Windows use
<localRepository>d:\repository</localRepository>
和在Linux
<localRepository>/media/234242342/repository</localRepository>
这篇关于适用于Linux和Windows的Maven本地存储库位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!