Skip to content

Commit

Permalink
Properly apply annotation processors in Panache-Hibernate extensions
Browse files Browse the repository at this point in the history
Unfortunately, HHH-17362 doesn't fix the problem,
and it's unlikely that it will ever be fixed.
See https://hibernate.atlassian.net/browse/HHH-17362?focusedCommentId=113465

We'll have to apply annotation processors the "right" way, as explained
in https://github.com/hibernate/hibernate-orm/blob/6.3/migration-guide.adoc
  • Loading branch information
yrodiere committed Dec 1, 2023
1 parent b153b63 commit 9e072ed
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 49 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<classmate.version>1.5.1</classmate.version>
<!-- WARNING: When updating, also align other properties on this version:
bytebuddy.version (just below), hibernate-orm.version-for-documentation (in docs/pom.xml)
and antlr.version.version in build-parent/pom.xml
and both hibernate-orm.version and antlr.version in build-parent/pom.xml
WARNING again for diffs that don't provide enough context: when updating, see above -->
<hibernate-orm.version>6.4.0.Final</hibernate-orm.version>
<bytebuddy.version>1.14.7</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
Expand Down
3 changes: 3 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@

<!-- MicroProfile TCK versions used to be defined here but have moved to the concrete tck modules -->

<!-- Panache needs to run the hibernate-jpamodelgen annotation processor,
and unfortunately annotation processors are not covered by dependency management -->
<hibernate-orm.version>6.4.0.Final</hibernate-orm.version>
<!-- Antlr 4 is used by the PanacheQL parser but also needs to match the requirements of Hibernate ORM 6.x-->
<antlr.version>4.13.0</antlr.version>

Expand Down
18 changes: 7 additions & 11 deletions extensions/panache/hibernate-orm-panache-kotlin/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,6 @@
<artifactId>quarkus-panache-common-deployment</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Workaround for https://hibernate.atlassian.net/browse/HHH-17362 -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -117,6 +106,13 @@
<goal>kapt</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-orm.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
</annotationProcessors>
Expand Down
20 changes: 7 additions & 13 deletions extensions/panache/hibernate-orm-panache/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Workaround for https://hibernate.atlassian.net/browse/HHH-17362 -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<scope>provided</scope>
</dependency>

<!-- Explicitly provide banned dependencies, in the correct version -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
Expand All @@ -80,6 +67,13 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-orm.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
</annotationProcessors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Workaround for https://hibernate.atlassian.net/browse/HHH-17362 -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-panache-common-deployment</artifactId>
Expand Down Expand Up @@ -130,6 +119,13 @@
<goal>kapt</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-orm.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
</annotationProcessors>
Expand Down
20 changes: 7 additions & 13 deletions extensions/panache/hibernate-reactive-panache/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
</dependency>
<!-- Workaround for https://hibernate.atlassian.net/browse/HHH-17362 -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<scope>provided</scope>
</dependency>

<!-- Explicitly provide banned dependencies, in the correct version -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.eclipse.angus</groupId>
<artifactId>angus-activation</artifactId>
Expand All @@ -84,6 +71,13 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate-orm.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</annotationProcessor>
</annotationProcessors>
Expand Down

0 comments on commit 9e072ed

Please sign in to comment.