This post explains, how you will know maven repo path in a host. This becomes even more important as in some of the cases default path (${user.home}/.m2/settings.xml) is overridden.
Checking if maven is installed is quite trivial. Just use version argument.
$mvn -version
Apache Maven 3.0.3 (r1075438; 2011-02-28 23:01:09+0530)
Maven home: /bin/maven3
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /bin/jdk8/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"
Printing local repository path
Maven need to be properly installed to get the local repository path. Above command confirms it. It also prints Java home path. This means that for maven to work properly, Java home should be configured. Let's see how to print maven local repository.
$mvn -X
or
$mvn -debug
Output of above commands will be verbose. We can use grep/egrep utility to limit the console output.
$mvn -X | grep "repository"
[DEBUG] Using local repository at /home/user/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/user/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for /home/user/.m2/repository
So the command prints the path of local repository. Also maven setting file named as settings.xml is usually kept inside .m2 directory.
References:
http://maven.apache.org/guides/introduction/introduction-to-repositories.html
No comments:
Post a Comment