Can we Change Maven default Directory(.m2) Name? Can we Change Maven default Directory(.m2) Name? linux linux

Can we Change Maven default Directory(.m2) Name?


YES:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0                  http://maven.apache.org/xsd/settings-1.0.0.xsd">   <localRepository>${user.home}/.m2/repository</localRepository>   <interactiveMode>true</interactiveMode>   <usePluginRegistry>false</usePluginRegistry>   <offline>false</offline>   ... </settings>
  • localRepository: This value is the path of this build system's local repository. The default value is ${user.home}/.m2/repository. This element is especially useful for a main build server allowing all logged-in users to build from a common local repository.

  • interactiveMode: true if Maven should attempt to interact with the user for input, false if not. Defaults to true.

  • usePluginRegistry: true if Maven should use the ${user.home}/.m2/plugin-registry.xml file to manage plugin versions, defaults to false. Note that for the current version of Maven 2.0, the plugin-registry.xml file should not be depended upon. Consider it dormant for now.

  • offline: true if this build system should operate in offline mode, defaults to false. This element is useful for build servers which cannot connect to a remote repository, either because of network setup or security reasons.


Yes, you can do that. But make sure, you make the appropriate path change in the <localRepository> of your settings.xml present in the conf folder of maven home directory.