macOS – /Users/{username}/.m2/repository Linux – /home/{username}/.m2/repository Windows – c:\Users{username}.m2\repository
Customize Maven Local Repository
The settings.xml is the main configuration file of Maven. It is available for user-level or system-level configurations.
Global level: Is available at ${MAVEN_HOME}/conf/settings.xml is applied for all Maven users on the system that share the same installation. User level: Can be found at ${HOME}/.m2/settings.xml. This is the user-specific configuration and overrides the global configuration.
To customize the local repository, edit settings.xml and change directory location with
The configuration file looks like the below:
Define Maven Local Repository at Command Line
Changes made in settings.xml applied for all commands. We can also specify the local repository as a command line parameter using the maven.repo.local option. which allows us to pass the local repository location as a command-line parameter:
Conclusion
In this tutorial, you have learned about setting the local repository path in Maven. This local repository is used to store project artifacts.