This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven cannot access javax.annotation.PostConstruct

 
Syed Mahdi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello all!


I am trying to build a war project. and on compile it gives me this error:

[compiler:compile] Compiling 432 source files to C:\Beta\ECORP5\ECORP5-web\target\classes ------------------------------------------------------------- COMPILATION ERROR : ------------------------------------------------------------- \Beta\fin\fin-web\src\main\java\com\comp\fin\utils\Formatter.java:[23,-1] cannot access javax.annotation.PostConstruct bad class file: C:\Beta\fin\fin-web\target\endorsed\javaee-endorsed-api-6.0.jar(javax/annotation/PostConstruct.class) class file has wrong version 50.0, should be 49.0 1 error


I am not able to get rid of this error. I am using java 6 and jdk 1.5 here is my POM.xml or part of it without unrelated stuff:


I am using NetBeans IDE to create an ear project and this is the POM of the war module. I am building it separately. I dont think that should be a problem.

I will appreciate if some one can tell me what is wrong here that it gives this error.

On a side note: When i created the Maven Ear project it was using JavaEE 6 so the war module was also using JEE6 but when i added some files in the webApp directory of the war module the JEE version changed in the war module properties to Java EE 1.4 I dont know how it is doing that and why or which file is making it change on module level.

Thanks Syed..

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the compiler plugin to 1.6. This message seems to be saying that the annotation processor is a 1.6 class, which you're trying to mix with 1.5 compiled classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic