Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0 Update process does not update hibernate-jpamodelgen annotation processor #32615

Closed
famod opened this issue Apr 13, 2023 · 12 comments
Closed
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working

Comments

@famod
Copy link
Member

famod commented Apr 13, 2023

Describe the bug

Not sure this is out of scope for the update goal/process, but I couldn't find anything in the migration guide.

Running mvn io.quarkus:quarkus-maven-plugin:3.0.0.Final:update -N -Dstream=3.0 leaves hibernate-jpamodelgen annotation processor untouched (if present), resulting in uncompilable metamodel classes with javax imports.

In my case the processor is simply added as a depedency to maven-compiler-plugin (together with other processors).

Expected behavior

Metamodel classes using jakarta imports

Actual behavior

Metamodel classes using javax imports -> compile errors

How to Reproduce?

None, ATM.

Output of uname -a or ver

No response

Output of java -version

17.0.6

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.6 -> 3.0.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Maven 3.8.8

Additional information

No response

@famod famod added the kind/bug Something isn't working label Apr 13, 2023
@quarkus-bot quarkus-bot bot added area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE labels Apr 13, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 13, 2023

/cc @Sanne (hibernate-orm), @gsmet (hibernate-orm), @yrodiere (hibernate-orm)

@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

I’m not sure we can do something about it but if you attach a sample project, I can have a look.

@famod
Copy link
Member Author

famod commented Apr 13, 2023

No sure it's worth the effort. Adding something to the migration guide is probably enough?

Btw, for each and every update of Quarkus I'm going through several dependency and plugin versions in my project, comparing them to what has changes in Quarkus BOM:

  • hibernate-orm.version -> hibernate-jpamodelgen
  • jacoco.version -> jacoco-maven-plugin
  • jandex.version -> jandex-maven-plugin

So, such potential issues are not entirely new to me, but it would be great to have more tooling support for that (in general, not just for major upgrades like 3.0).

@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

I think it's worth it if doable.

@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

If you can put together an example with all of them, I'll see if we can do something. IIRC the plugin update facilities in OpenRewrite are scarce but we could work on improving that.

@Sanne
Copy link
Member

Sanne commented Apr 13, 2023

Regarding hibernate-jpamodelgen, we should automate the generation, so that you don't have to enable the plugin and that it works better with live-reload capabilities. I think we had an issue already for it, just never got to do it.

@famod
Copy link
Member Author

famod commented Apr 13, 2023

@Sanne while this is certainly a good idea for smaller projects/services, I don't think it works that well when you have multiple modules and the quarkus app is not built in the module that contains the entities (or better to say "users" of the metamodel classes). So I'm not sure that approach can cover all cases.

@famod
Copy link
Member Author

famod commented Apr 13, 2023

If you can put together an example with all of them, I'll see if we can do something. IIRC the plugin update facilities in OpenRewrite are scarce but we could work on improving that.

I'll see what I can do. I'm still kind of blocked by openrewrite/rewrite#3022 (comment), but locally I can replace the versions with something static for now.

@gsmet
Copy link
Member

gsmet commented Apr 13, 2023

I think updating a plugin dependency will be a problem. You can rewrite the dependencies but you cannot update one dependency in particular.
It wouldn't be that hard to add it to OpenRewrite though.

@Sanne
Copy link
Member

Sanne commented Apr 13, 2023

@Sanne while this is certainly a good idea for smaller projects/services, I don't think it works that well when you have multiple modules and the quarkus app is not built in the module that contains the entities (or better to say "users" of the metamodel classes). So I'm not sure that approach can cover all cases.

Good point - it might need some flexibility, perhaps some options to control the output directory. But I suspect doing it OOB would help most people, and for most other people I'd expect that if entities are provided by an external jar, for it to contain the metamodel as well?

Let's continue on #29068

@famod
Copy link
Member Author

famod commented Jan 8, 2024

FWIW, I think this has become mostly obsolete, given that the latest maven-compiler-plugin version applies dependencyManagement to annotationProcessorPaths and jpamodelgen is defined already in the Quarkus BOM.

Even ECJ should play along nicely after codehaus-plexus/plexus-compiler#350 is released.

People still using the compiler-plugin dependencies to define annotation processors are still affected, though.

@yrodiere
Copy link
Member

yrodiere commented Jan 8, 2024

Thanks for following up.

People still using the compiler-plugin dependencies to define annotation processors are still affected, though.

Right, but these people will be out of luck once they upgrade to Quarkus 3.7+/ORM 6.4+ since jpamodelgen now has mandatory dependencies and thus will fail when registered that way.

The right way to use jpamodelgen (regardless of your version of Quarkus) is to use maven-compiler-plugin 3.12.1+ and annotationProcessorPaths; see https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.7#static-metamodel-annotation-processor-hibernate-jpamodelgen-can-no-longer-be-used-as-a-provided-dependency.

I'll tentatively close this in favor of #37477, but let me know if this needs to be reopened.

@yrodiere yrodiere closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants