跳至主要內容

[eclipse] Where is the Maven Local Repository?

The Local Repository
1
Windows: C:\Users\\.m2
1
Linux: /home//.m2
1
Mac: /Users//.m2
And of course, for both on Linux or Mac:
1
Linux/Mac: ~/.m2
1. Find Maven Local Repository
1.1 If the default .m2 is unable to find, maybe someone changed the default path. Issue the following command to find out where is the Maven local repository:
mvn help:evaluate -Dexpression=settings.localRepository
Copy
1.2 Example :
Terminal
D:\> mvn help:evaluate -Dexpression=settings.localRepository
[INFO] Scanning for projects…
[INFO]
[INFO] ——————< org.apache.maven:standalone-pom >——————-
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ——————————–[ pom ]———————————
[INFO]
[INFO] — maven-help-plugin:3.1.0:evaluate (default-cli) @ standalone-pom —
[INFO] No artifact parameter specified, using ‘org.apache.maven:standalone-pom:pom:1’ as project.
[INFO]
C:\opt\maven-repository
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 2.598 s
[INFO] Finished at: 2018-10-24T16:44:18+08:00
[INFO] ————————————————————————
Copy
In above output, The Maven local repository is relocated to C:\opt\maven-repository
2. Update Maven Local Repository
2.1 Find this file {MAVEN_HOME}\conf\settings.xml and update the localRepository.
{MAVEN_HOME}\conf\settings.xml


D:/maven_repo
Copy
Note
Issue mvn -version to find out where is Maven installed.
2.2 Save the file, done, the Maven local repository is now changed to D:/maven_repo.
reference: https://www.baeldung.com/maven-local-repository
https://www.mkyong.com/maven/where-is-maven-local-repository/

分類:eclipse
由 Compete Themes 設計的 Author 佈景主題