title: Getting variables from pom.xml java
body: <p>I am using eclipse with maven for a mobile automation test on a mobile webpage.</p>
  
  <p>I am defining the following in my pom.xml </p>
  
  <pre><code>&lt;properties&gt;
      &lt;MY_VARIABLE&gt;www.google.com/&lt;/MY_VARIABLE&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>but when i am calling this using</p>
  
  <pre><code>String testurl1 = System.getProperty("MY_VARIABLE");
  </code></pre>
  
  <p>it always seems to return null.</p>
  
  <p>I also tried the following way of defining variable</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.16&lt;/version&gt;
      &lt;configuration&gt;
          &lt;systemPropertyVariables&gt;
          &lt;MY_VARIABLE&gt;www.google.com&lt;/MY_VARIABLE&gt;
          &lt;/systemPropertyVariables&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>but still am getting the value as null.</p>
  
  <p>I could use some help
  Thanks.</p>