title: how to make maven with jenkins use specific jdk?
body: <p>I have jdk 7 and 8 on my machine, JAVA_HOME points to java 7, and Jenkins uses java 8. I created a maven project and i am trying to build it on jenkins using java 8 but i get the following error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven-demo: Compilation failure -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  Build step 'Invoke top-level Maven targets' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>in pom.xml I added the following:</p>
  
  <pre><code>&lt;properties&gt;
      &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
      &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.1&lt;/version&gt;
          &lt;configuration&gt;
            &lt;verbose&gt;true&lt;/verbose&gt;
            &lt;fork&gt;true&lt;/fork&gt;
             &lt;source&gt;1.8&lt;/source&gt;
             &lt;target&gt;1.8&lt;/target&gt;
            &lt;executable&gt;path/to/jdk/bin/javac&lt;/executable&gt;
          &lt;/configuration&gt;
        &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>but I still get the same error with either method of the 2 above.</p>
  
  <p>How can I update it to make maven use java 8 ?</p>