title: maven compiles java projects in jdk 1.4 mode while running java 1.7?
body: <p>I have a big maven project divided to some modules.</p>
  <p>I decided to give the pmd (code quality check) module with maven.</p>
  <p>when I try to test the pmd module using the command</p>
  <pre><code>mvn pmd:pmd
  </code></pre>
  <p>I get the following types of warnings:</p>
  <ul>
  <li>Can't use generics unless running in JDK 1.5 mode!</li>
  <li>Can't use annotations when running in JDK 1.4 mode!</li>
  <li>Can't use enum as a keyword in pre-JDK 1.5 target</li>
  </ul>
  <p>looks like maven compiles the projects using jdk 1.4 for some reason.</p>
  <p><code>java -version</code> output:</p>
  <pre><code>java version &quot;1.7.0_05&quot;
  OpenJDK Runtime Environment (IcedTea7 2.2.1) (Gentoo build 1.7.0_05-b21)
  OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)
  </code></pre>
  <p>I use gentoo linux.</p>
  <pre><code>Linux ufk-work 3.5.2-gentoo #1 SMP Sun Aug 19 18:58:32 IDT 2012 x86_64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz GenuineIntel GNU/Linux
  </code></pre>
  <p><code>mvn -version</code> output:</p>
  <pre><code>Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
  Maven home: /usr/share/maven-bin-3.0
  Java version: 1.7.0_05, vendor: Oracle Corporation
  Java home: /usr/lib64/icedtea7/jre
  Default locale: en_US, platform encoding: ANSI_X3.4-1968
  OS name: &quot;linux&quot;, version: &quot;3.5.2-gentoo&quot;, arch: &quot;amd64&quot;, family: &quot;unix&quot;
  </code></pre>
  <p>so any ideas how to make sure that maven will compile for jdk 1.7 and not 1.4 ?</p>
  <p>I googled and found usage examples of the maven-compiler-plugin as found in the following url: <a href="http://twit88.com/blog/2008/03/09/maven-compile-your-application-to-be-14-15-or-16-compatible/" rel="nofollow noreferrer">http://twit88.com/blog/2008/03/09/maven-compile-your-application-to-be-14-15-or-16-compatible/</a></p>
  <p>unfortunately the results are exactly the same.</p>
  <p>any information regarding the issue would be greatly appreciated.</p>
  <p>thank you so much!</p>
  <p>kfir</p>
  <h1>update</h1>
  <p>I tried adding the maven-compiler-plugin and the maven-pmd-plugin to my main pom.xml
  but the results are exactly the same.</p>
  <p>the updated pom.xml can view at <a href="http://bpaste.net/show/41166/" rel="nofollow noreferrer">http://bpaste.net/show/41166/</a></p>