code: protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException {
          if(mi!=null) {
              // if somebody has use M2_HOME they will get a classloading error
              // when M2_HOME points to a different version of Maven2 from
              // MAVEN_HOME (as Maven 2 gives M2_HOME priority.)
              //
              // The other solution would be to set M2_HOME if we are calling Maven2
              // and MAVEN_HOME for Maven1 (only of use for strange people that
              // are calling Maven2 from Maven1)
              mi.buildEnvVars(env);
          }
          // just as a precaution
          // see http://maven.apache.org/continuum/faqs.html#how-does-continuum-detect-a-successful-build
          env.put("MAVEN_TERMINATE_CMD","on");
  
          String jvmOptions = env.expand(this.jvmOptions);
          if(jvmOptions!=null)
              env.put("MAVEN_OPTS",jvmOptions.replaceAll("[\t\r\n]+"," "));
      }
docs: Build up the environment variables toward the Maven launch.