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
If you are using CentOS version 7 the Maven local repository will be:
/root/.m2/repository/
It is located in the /home/.m2 directory, the folder is probably hidden. So, you'll need to press Ctrl+H to see hidden folders.
You can run :
mvn help:evaluate -Dexpression=settings.localRepository
source
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>
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>
Can't you just define both locations as separate repositories and let maven use the available one?
Or symlink /media/234242342/repository
to /repository
and use this path for both builds.
Also, have a look at maven profiles, it might be helpful!