0

I am writing a code generator that generates additional classes for each class annotated with a certain annotation. I have other classes in my project that has to refer these generated classes. If I can somehow integrate my code generator into the automatic build process, then I figure the generated code will always stay up to date.

Is this possible? Can I do this if write a new custom builder?

EDIT (2/7): I looked at Lombok which is doing something similar. However, it modifies the AST from an annotation processor by using undocumented internal methods in eclipse. I don't want to take that risk. Moreover, I think they never wanted to do source generation - just byte code generation.

rahulmohan
  • 1,285
  • 11
  • 19
  • 1
    https://projectlombok.org/ Adds similar functionality to Java and eclipse, so it may be worth looking how it is done there. – Jonah Graham Feb 07 '16 at 07:31

1 Answers1

1

Assuming you have annotation processing configured, you can use the annotation processing plugin for m2e. Here's the marketplace link: https://marketplace.eclipse.org/content/m2e-apt

ernest_k
  • 44,416
  • 5
  • 53
  • 99