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
?
By default, Maven local repository is defaulted to ${user. home}/. m2/repository folder : Unix/Mac OS X – ~/.
The Maven local repository is located in the /home/. m2 directory, the folder is probably hidden.
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.
So for your specific system, in Windows use
<localRepository>d:\repository</localRepository>
and in Linux
<localRepository>/media/234242342/repository</localRepository>
You don't do that in the POM, but in your ~/.m2/settings.xml
, which would be different for both Linux and Windows, so no problem. See the localRepository
element:
<settings> <localRepository>d:\repository</localRepository> <!-- or --> <localRepository>/media/234242342/repository</localRepository> ... </settings>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With