To print maven default configurations, run following command:
Command:
mvn -X
This will show you maven default configurations similar to following:
Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_79, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-i386/jre Default locale: en_IN, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-23-generic-pae", arch: "i386", family: "unix" cl[INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml [DEBUG] Reading user settings from /home/webner/.m2/settings.xml [DEBUG] Using local repository at /home/webner/.m2/repository e[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/webner/.m2/repository
To change default location of maven local repository:
Create a settings.xml file inside your_home_directory/.m2/ folder and add following tag to xml file:
<localRepository> path to local repository location </localRepository>
You can access system defined properties using ${ } symbol:
Create settings.xml file in home/.m2/settings.xml and add below content to the file:
${user.home}/workspace
When we ran mvn -X again in command prompt I got following output:
Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_79, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-i386/jre Default locale: en_IN, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-23-generic-pae", arch: "i386", family: "unix" [INFO] Error stacktraces are turned on. [DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml [DEBUG] Reading user settings from /home/webner/.m2/settings.xml [DEBUG] Using local repository at /home/webner/workspace [DEBUG] Using manager Enhanced Local Repository Manager with priority 10 for /home/webner/workspace [INFO] Scanning for projects... [DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none) [DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
Our local repository location changed from .m2/repository to /home/webner/workspace.