title: How can I verify that my MAVEN_OPTS environment variable is being passed to the java process being started?
body: <p>I'm setting some options -Dmyflag=myvalue in MAVEN_OPTS.  I know this works based on other testing I've done (when using <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html#using-boot-running-with-the-maven-plugin" rel="nofollow noreferrer">mvn spring-boot:run</a> ) but a newly set value I'm using doesn't seem to be working.</p>
  
  <p>The first place to start is to make sure the option is being passed to the program being started by maven.  In my case, I'm running a unit test that dsdsneeds some options set on the command line.</p>
  
  <p><strong>Is there a maven command that will show me the -Doptions that are being passed to the java commands that are started by Maven?</strong></p>
  
  <p><em>NOTE: This may be an issue with the surefire plugin not passing MAVEN_OPTS when starting tests.</em></p>
  
  <p>I've tried</p>
  
  <pre><code>mvn -X clean install
  </code></pre>
  
  <p>and I see output that implies that a test is being started, the output is something like:</p>
  
  <pre><code>Forking command line: /bin/sh -c cd /my/proj &amp;&amp; /usr/bin/java -jar /.../my.jar
  </code></pre>
  
  <p>And I don't see any options being passed so I'm guessing that the MAVEN_OPTS are not being passed to the unit test that is running.</p>
  
  <p>Searching for answers I found these links:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/32120909/how-to-pass-parameter-to-maven-test">How to pass parameter to maven test</a></p></li>
  <li><p><a href="https://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html" rel="nofollow noreferrer">Passing properties to surefire plugin</a> (Not on StackOverflow).</p></li>
  <li><p><a href="http://maven.40175.n5.nabble.com/Passing-command-line-arguments-to-surefire-plugin-td2263928.html" rel="nofollow noreferrer">Passing command line arguments to surefire plugin</a>  (Not on StackOverflow).</p></li>
  </ul>