How do I globally change the location of maven's .m2
directory?
Maven uses ${user.home}/.m2
for it's settings, repository cache, etc.
I know that I can:
- point to a different dir for the repository cache (by changing the
localRepository
attribute in my global config file), but not for anything else (settings.xml
, for instance). - Use the
-s
CLI option, but I'd have to do that every time I use maven.
But ideally, I'd like a global solution. Intuitively that should be possible..
I'd like to do this because my company sets my ${user.home} to a shared drive which is prone to network issues.