This may sounds very easy to do but it turned out to be much more complicated than I anticipated. At work, we have an HTTP proxy and SVN authentication using our domain user. As long as you are logged in with your user, it is working fine but if you need to setup background services or a shared user for whatever reason you all the sudden need a dummy user to perform the NTLM authentication for you.

We have a Hudson test instance using that dummy user of ours and I wanted to reuse it for our shared demo account (the demo purpose here of course is to avoid creating yet another stupid dummy user). Since the Tomcat service hosting Hudson was running as that user, all the Maven defaulting where used by hudson like enviromnent MAVEN_OPTS (the JVM options used by the Maven process) and the local settings.xml configuration.

Since Hudson is using the Maven embedder, using a separate Maven distribution with a hackish launch script won't do. Instead, you have to set the org.apache.maven.global-settings system property pointing to your customized local settings.xml file for Hudson. There you can specify the local repository location, proxy settings, profile, etc without affecting usage of Maven on the command line.

To do so go to Maven Hudson > Configure System and set something like the following in the Global MAVEN_OPTS option

CODE:
  1. -Dorg.apache.maven.global-settings=/var/lib/hudson/m2-env/settings.xml

Pay attention that using this option will ignore any settings set in the MAVEN_OPTS environment variable. You'll have to copy/paste them there as well for them to be taken into account.