File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes maven cannot access javax.annotation.PostConstruct Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "maven cannot access javax.annotation.PostConstruct " Watch "maven cannot access javax.annotation.PostConstruct " New topic

maven cannot access javax.annotation.PostConstruct

Syed Mahdi
Ranch Hand

Joined: Aug 27, 2004
Posts: 45

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\[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

Joined: Jun 25, 2001
Posts: 17417

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: maven cannot access javax.annotation.PostConstruct
It's not a secret anymore!