Maven user settings.xml not merged with global settings.xml
Answered
According to https://maven.apache.org/settings.html the global settings.xml and the user settings.xml should be merged, but Intellij doesn't respect this, so anything in the global settings.xml is completely ignored.
Please sign in to leave a comment.
Could you elaborate which setting defined in global settings.xml is ignored? E.g. defining <localRepository> path works for me as expected
profiles and mirrors at least. there is a mirror defined in global settings.xml, and a profile that should be enabled by default but isn't even visible in the list of profiles.
hm, working fine here, please check if you set appropriate maven at File | Settings | Build, Execution, Deployment | Build Tools | Maven => Maven home directory
It's left on the default, ~/.m2/settings.xml.
I'm not sure if I've made the problem clear, the correct behaviour is that you let Maven point at the default user settings (~/.m2/settings.xml), it is meant to merge this together with the global Maven settings.xml (/etc/maven/settings.xml). Intellij just reads the user settings.xml and ignores the global settings.xml.
it's clear, my question was about to check if you set the correct maven home in IntelliJ:
So, in your case, File | Settings | Build, Execution, Deployment | Build Tools | Maven => Maven home directory setting should look like "/etc/maven"
Can you confirm it?
No it's not set to that. The Maven home directory setting is for where Maven itself is installed, I can't set it to /etc/maven because there is no Maven installed there, only the global settings.xml. I don't know if this is a Linux thing that it puts the global settings in /etc/maven instead of $MAVEN_HOME/conf
Apologies, this appears to be a mess I've made on my own system. The maven rpm uses /etc/maven/settings.xml because it symlinks ${MVN_HOME}/conf/settings.xml to it, but I was using a separate maven install (from a tarball) that does not have the symlink.
There does seem to be a different problem where it doesn't seem to 'see' changes to the symlinked file reliably, which is solved if I hard link to the /etc/maven/settings.xml file instead.