0

I'm looking to programmatically determine where my .m2 directory when inside the JVM. Is there a properties value or an environment key that is avaliable?

zcaudate
  • 13,998
  • 7
  • 64
  • 124
  • 1
    So when you run your program you want to know where the .m2 directory is? Even if you can do that, will it do what you want? If you ran your code on my machine it'd find my .m2 directory, but it would not contain the files that you are expecting. – DaveH Mar 12 '14 at 20:56
  • When doing maven plugin development that location can be accessed as described here: http://stackoverflow.com/a/7429731/1081849 From your built application it wont be available unless you pass it yourself. Your built application is totally separated from maven. – sbk Mar 12 '14 at 20:59

2 Answers2

2

check inside your maven install directory

Maven\conf\setting.xml

<!-- localRepository
 | The path to the local repository maven will use to store artifacts.   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
-->

you can change it to your own directory

loknath
  • 1,362
  • 16
  • 25
1

If you are using Windows Machine :

Maven Directory Path :- C:\Users\[user-name]\.m2

If you are using Linux Machine :

Maven Directory Path :- \home\[user-name]\.m2

unknown
  • 4,859
  • 10
  • 44
  • 62