I would like to use Criteria API in my new project and from what I understood, I also need to do annotation processing. Since there Java 5 on the server, how is this possible using Java 5 and Maven?
+1
A:
The annotation processing API from Java 6 (JSR 269) is different different from Java 5 (JSR 175) and I don't think you can run a Java 6 Processor
using the apt
command from Java 5 (and I assume the various implementations are all using the Java 6 API).
So your options are IMO:
- write your own static meta model generator using the Java 5 API (if possible?) and use the apt-maven-plugin
- builds on Java 6 with a Java 5 target and either use the maven-compiler-plugin support or the maven-annotation-plugin (see for example this blog post - and the comments)
- generate the classes on another machine (with Java 6 available) and check them in your VCS.
Depending on what's possible for you and the chosen implementation, I could expend the Maven part if required.
Pascal Thivent
2010-10-22 13:59:06