invalid target release: 1.7


I have seen similar questions, but haven't yet found the answer.

Using maven compile, I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project api: Fatal error compiling: invalid target release: 1.7 -> [Help 1]

Here is the pom.xml:


Javac version:

javac 1.7.0_25

Java version:

java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Any idea what it could be?

This question is tagged with java maven java-7

~ Asked on 2013-11-10 15:20:12

The Best Answer is


You need to set JAVA_HOME to your jdk7 home directory, for example on Microsoft Windows:

  • "C:\Program Files\Java\jdk1.7.0_40"

or on OS X:

  • /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home

~ Answered on 2013-11-26 13:18:22


Other than setting JAVA_HOME environment variable, you got to make sure you are using the correct JDK in your Maven run configuration. Go to Run -> Run Configuration, select your Maven Build configuration, go to JRE tab and set the correct Runtime JRE.

Maven run configuration

~ Answered on 2014-02-24 03:18:38

Most Viewed Questions: