Thursday, May 9, 2013

Maven and Java 7 : Fatal error compiling: invalid target release: 1.7


 Problem

On a Maven Project I change Java version (1.6 to 1.7) in my pom.xml file and I have the following error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project MetricViewer: Fatal error compiling: invalid target release: 1.7 -> [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/MojoExecutionException



Solution

You have probably Java 1.6 in your classpath.
Do the following to check it :

mvn clean install --debug

  1 Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
  2 Maven home: /usr/share/maven
  3 Java version: 1.6.0_35, vendor: Apple Inc.
  4 Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home





I found this solution at http://stackoverflow.com/questions/14043042/compiling-java-7-code-via-maven

Wednesday, May 1, 2013

http://java.dzone.com/articles/java-ee-7-approved


If you want to see which JSR will be in Java 7, see that link : http://java.dzone.com/articles/java-ee-7-approved