wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven settings.xml file on Windows 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven settings.xml file on Windows 7" Watch "Maven settings.xml file on Windows 7" New topic
Author

Maven settings.xml file on Windows 7

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5835
    
    7

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...)


JBoss In Action
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10141
    
165

[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.

[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10141
    
165

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

Joined: May 14, 2008
Posts: 5835
    
    7

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!
 
GeeCON Prague 2014
 
subject: Maven settings.xml file on Windows 7