title: Extract Maven Dependency Version from POM
body: <p>Given that I have Dependency groupId and artifactId, how do I extract the version for this dependency from the pom.xml file?</p>
  
  <p>Example: I want to be able to extract the dependency version below if I query using the artifactId and groupId.</p>
  
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;commons-pool&lt;/groupId&gt;
              &lt;artifactId&gt;commons-pool&lt;/artifactId&gt;
              &lt;version&gt;1.6&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I want to assign the version to a global environment variable i.e. DEP_VERSION=1.6</p>