AspectJ and EclipseLink Model Generation in STS
Spring Roo projects frequently combine AspectJ load-time weaving with EclipseLink JPA. When generating canonical metamodel classes for the Criteria API, the org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
may never execute if AspectJ tooling intercepts the annotation processing pipeline.
Symptoms
mvn compile
or STS incremental builds fail to produce*_
.java metamodel classes.- The Eclipse Problems view reports
cannot find symbol
errors forQ
-style criteria classes.
Resolution Steps
- Disable the AspectJ Development Tools → Enable AspectJ support option for the project.
- Clean the workspace (
Project → Clean
) to remove stale build output. - Rebuild; the EclipseLink canonical model generator now emits the metamodel classes under
target/generated-sources/annotations
. - If AspectJ weaving is required, switch to Maven or Gradle builds and run the annotation processor during the command-line compile phase instead of STS incremental compilation.
Recommendation
Where possible, standardise on Maven/Gradle for annotation processing workflows. IDE-only configuration often drifts between workstations and masks build failures that would surface in CI.