title: Maven set environment variable inside pom.xml
body: <p>I'm trying to set a environment variable inside <code>pom.xml</code>. I was doing something like this with <code>maven-surefire-plugin</code>:</p>
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.22.2&lt;/version&gt;
    &lt;configuration&gt;
      &lt;forkMode&gt;always&lt;/forkMode&gt;
      &lt;environmentVariables&gt;
        &lt;MY_PATH&gt;${project.parent.relativePath}&lt;/MY_PATH&gt;
      &lt;/environmentVariables&gt;
    &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  <p>But i can't access it from another <code>pom.xml</code> with <code>${env.MY_MATH}</code>. I can only access it with <code>System.getenv(&quot;MY_PATH&quot;)</code> inside JAVA. I need to access it in another <code>pom.xml</code>. Maybe there are some other plugins that are doing that? I know that i can pass it with <code>mvn -DMY_PATH=some/path install</code> but it will just set it inside the pom where i passed this var and i need it to be setted as global env.</p>