Reputation: 537
I saw a weird behavior when I build using maven. I found the maven is using the local repo in a directory which is different from what I configured in settings.xml. Even worse, I don't know where the directory that maven is using comes from. To investigate, I have enabled -X when I execute the maven cmd, and I can see the setting.xml is used and the local repo directory. I can see the settings.xml (global and user) are the ones I configured. And the local repo directory is totally different from what I configured in tag (only configured in the user settings.xml).
I can't figure out why. Anyone has idea? Is there anyother config file that maven will check to overwrite the localRepository config in settings.xml?
Thanks in advance.
Upvotes: 0
Views: 649
Reputation: 196
Since you're sure about your global and user settings file, then the local repo could be overriden by the system/user property "maven.repo.local" this can be specified in multiple ways :
as user property : from maven cli like mvn -Dmaven.repo.local= ...
as system property : when set in MAVEN_OPTS like -Dmaven.repo.local= (it can be set in your maven.bat or maven.sh)
if maven.repo.local is not set as user or system property, then maven will look to localRepository config in user settings first then in global settings : if you specify a relative path in localRepository (repo/dir1) then the repo directory will be created under your project directory with the specified path if no option is avilable it uses the path /.m2/repository
Upvotes: 2