The good news is that Maven will tell you which Dependency is causing that. For instance, in my case it was java-web-api as shown in the error message:
[ERROR]
Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project hTask-web: Compilation failure |
[ERROR]
/Users/hordine/projects/hTask/hTask-web/src/main/java/com/hordine/htask/web/control/TaskController.java:[3,-1]
cannot access javax.servlet.http.HttpServletRequest |
[ERROR]
bad class file:
/Users/hordine/.m2/repository/javax/javaee-web-api/6.0/javaee-web-api-6.0.jar(javax/servlet/http/HttpServletRequest.class) |
[ERROR] class file has wrong version 50.0, should be 49.0 |
But anyway, there are 2 quick ways to fix this. One is to find an earlier version of your Dependency, which was compiled using Java 1.5, and the other is to install a Java 1.6 JRE and get Maven to use that one. The later can be as simple as setting the JAVA_HOME environment variable to your Java 1.6 installation.
That’s it for this post.
http://hordine.wordpress.com/2012/05/02/class-file-has-wrong-version-50-0-should-be-49-0-by-maven/
No comments:
Post a Comment