title: Maven specify settings file location via MAVEN_OPTS
body: <p>I need to use maven with a settings file in a specific location, normally you can give <code>MAVEN_OPTS</code> env variable but they are passed to JVM so the following will yield:</p>
  
  <pre><code>$ MAVEN_OPTS="-s /settings.xml"
  $ mvn clean
  Unrecognized option: -s
  Error: Could not create the Java Virtual Machine.
  Error: A fatal exception has occurred. Program will exit.
  </code></pre>
  
  <p>I searched a lot but found two keys, <code>org.apache.maven.user-settings</code> and <code>org.apache.maven.global-settings</code> which is explained <a href="https://docs.alfresco.com/5.1/tasks/alfresco-sdk-install-maven-opts.html" rel="nofollow noreferrer">here</a> but it seemed it was working with Maven 2 only. Aliasing <code>mvn</code> to <code>mvn -s /settings.xml</code> would probably work but I do not like it.</p>