You have to check Maven version:
mvn -version
You will find the Java version which Maven uses for compilation. You may need to reset JAVA_HOME if needed.
{JAVA_1_4_HOME}/bin/javacyou can try also...
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>{JAVA_HOME_1_7}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
Ok, I just solved this issue on my own too. It is more important your JAVA_HOME, if you don't have a lower or no version compared to source/target properties from the Maven plugin, you will get this error.
Be sure to have a good version in your JAVA_HOME and have it included in your PATH.
Could you try a newer plugin; on the maven site:
<version>3.0</version>
I saw the following too:
<compilerVersion>1.7</compilerVersion>
Diagnostics:
You can see which java version Maven uses by running "mvn --version"
Solution for Debian:
The mvn script sets the JAVA_HOME env variable internally by looking for javac (which javac). Therefore, if you have multiple java versions installed concurrently, e.g. JDK 6 and JDK 7 and use the Debian Alternatives system to choose between them, even though you changed the alternative for "java" to JDK 7, mvn will still use JDK 6. You have to change the alternative for "javac", too. E.g.:
# update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
EDIT:
Actually, an even better solution is to use update-java-alternatives (e.g.)
# update-java-alternatives -s java-1.7.0-openjdk-amd64
as detailed in https://wiki.debian.org/JavaPackage, because this will change all the alternatives to various Java tools (there's a dozen or so).
Please check you pom.xml for the below tags
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
it should point the required jdk version