John Manak
John Manak

Reputation: 13558

Annotation processing with Maven and Java 5 (JPA)

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?

Upvotes: 1

Views: 6287

Answers (1)

Pascal Thivent
Pascal Thivent

Reputation: 570385

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.

Upvotes: 2

Related Questions