title: Determine JDK home from Maven toolchain
body: <p>I have a Maven build configured to use <em>maven-toolchains-plugin</em>, with <em>~/.m2/toolchains.xml</em> simply configured for multiple JDKs:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF8"?&gt;
  &lt;toolchains&gt;
      &lt;toolchain&gt;
          &lt;type&gt;jdk&lt;/type&gt;
          &lt;provides&gt;
              &lt;version&gt;9&lt;/version&gt;
              &lt;vendor&gt;oracle&lt;/vendor&gt;
          &lt;/provides&gt;
          &lt;configuration&gt;
              &lt;jdkHome&gt;/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home&lt;/jdkHome&gt;
          &lt;/configuration&gt;
      &lt;/toolchain&gt;
      &lt;toolchain&gt;
          &lt;!-- ... several more JDKs ... --&gt;
      &lt;/toolchain&gt;
  &lt;/toolchains&gt;
  </code></pre>
  
  <p>My aim is to use the value of <code>jdkHome</code> within the POM, as an argument to the JDK9 <em>jlink</em> tool, but I can't find any way to extract the value, or set a usable property which references the <code>jdkHome</code>/<code>JAVA_HOME</code> of the toolchain JDK. Has anyone found a way to achieve this? I don't really want to have to resort to making yet another <em>exec-maven-plugin</em> or <em>maven-antrun-plugin</em> process just to set a property, and I figure there must be some easy way to achieve this which I've overlooked.</p>