Search code examples
mavenmaven-3

Sharing Maven local repository


Maven stores all jars under local repository ~/.m2/repository/. It occupies a lot of space when there are many users.

So, Is it possible to share this local repository by multiple users, perhaps under a different directory structure?


Solution

  • Of course you can share the local repository. You just need a folder that all of you have write permission. e.g.: /local/.m2/repository. And to share this folder, you all can change the settings.xml with new local repository as below:

     <localRepository>/local/.m2/repository</localRepository>
    

    Also you all can use the settings.xml in ${MAVEN_HONE}/conf and then you don't need to set private settings.xml.