title: Configure Jenkins to run Visual Studio bat file before Maven job
body: <p>I have a Maven module that utilizes the NAR plugin to build some JNI libraries, and in Jenkins I have configured a Maven project to build this module.  In order for these libs to be built, the Visual Studio bat file that sets up the path and other environment variables must be run.  I have tried several different ways to get this bat file to execute before the Maven commands are called, and none of them have worked correctly.  I know that Jenkins isolates all of the build process steps, so it can be difficult to get the environment set up, but I'm hoping someone has solved this particular issue.  Here's what I've tried:</p>
  
  <ol>
  <li><code>call</code>ing the bat file as a pre build step.</li>
  <li>Using the EnvInject plugin to call the bat file, both as a pre build step and as a pre job step.</li>
  <li>Setting the environment variables directly without calling the bat file using EnvInject.</li>
  <li><code>call</code>ing the bat file from the mvn.bat file (this failed because it appears Jenkins will call Maven directly, without using the bat file).</li>
  </ol>
  
  <p>As a workaround, I'm using the Freeform project type and setting the build steps to </p>
  
  <ol>
  <li><code>call</code> the bat file.</li>
  <li>Directly call maven with appropriate parameters.</li>
  </ol>
  
  <p>This works, but it's not as nice as using the Maven project type, ex. a failed unit test will fail the entire build instead of just sending a warning.  Is there a way to configure this as a Maven project?</p>