• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven settings.xml file on Windows 7

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason Maven is reading the settings.xml file from the Windows directory instead of from my user directory:

[DEBUG] Reading global settings from c:\apps\java\apache-maven-3.0.4\conf\settings.xml
[DEBUG] Reading user settings from C:\Windows\system32\config\systemprofile\.m2\settings.xml
[DEBUG] Using local repository at C:\Windows\system32\config\systemprofile\.m2\repository

It should be reading the file from c:\User\peter\.m2\settings.xml (yes, that file exists). And it used to read the file from there.

I'm running Windows 7, and I have UAC turned off, so my command prompt is running in administrator mode. When I look at the env vars that are set I see:

HOME=C:\Users\peter
HOMEDRIVE=C:
HOMEPATH=\Users\peter

So why is Maven not using that information to locate the .m2 directory?

Hmm, I recently (within the last day or two) install JDK 1.6.0_33, could that have anything to do with this? Nope, probably not that - I tried JDK 1.5.0_19 and it still looks at C:\Windows\system32\config\systemprofile\.m2\settings.xml

This is happening on my home desktop. And I admit that it has been a while since I tried a Maven build on that system. I have a Windows 7 and a 2008 SR2 system at work (both with UAC turned off) and they behave properly (finding the file at c:\users\xxx\.m2\settings.xml).

Has anyone else seen this? Any ideas as to why? (For now, I'll move my settings.xml file to the Maven/conf directory...)
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[DEBUG] Reading user settings from C:\Windows\system32\config\systemprofile\.m2\settings.xml


What does System.getProperty("user.home") return on that system? In fact, running mvn with the -X param might even dump those values being picked up.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks related to http://www.coderanch.com/t/517573/java/java/System-getProperty-user-home-unreliable and the bug referenced in there.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That bug report explains it. Most of the folder locations in the given registry location (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders) were pointing to C:\Windows\system32\config\systemprofile. Must have been something that installed that did this. And actually, Windows 7 doesn't use this registry setting any more, instead it uses HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders. Anyway, I corrected the registry entries ans things are working as they should.

Whoa, this is my 5000th post! Break out the party hats! The next round's on me!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic