Define dependencies of hibernate-jpamodelgen as api

Description

To be clear, this is to address a short-coming in Maven in terms of how it handles annotation processors that simply is not an issue in Gradle (which has first-class support for javac’s processorpath).

Starting in 6.3, hibernate-jpamodelgen defines some implementation dependencies.

When integrated TheRightWay into Gradle, users have no problem -

You can do “the same” in Maven albeit in a way fulgier syntax and without the ability to apply a platform (BOM) -

Unfortunately, what is easier in Maven is TheWrongWay, simply adding jpamodelgen as a normal compile or provided scope dependency. In either case, jpamodelgen’s implementation (runtime) scoped dependencies won’t be transitively added to the project’s compile classpath for the annotation processor to have access to them.

There is a large debate as to why this is wrong. Bottom line is that it can lead to leaking unwanted dependencies onto the project’s compile classpth.

To help here, we could consider making those dependencies api which translates to Maven’s compile scope which would then be transitively added to the project’s compile classpath.

Activity

Steve EbersoleDecember 19, 2023 at 11:40 AM

Thanks for following up

Réda Housni AlaouiDecember 19, 2023 at 9:53 AM

maven-compiler-plugin 3.12.0 has been released today. I can confirm that annotationProcessorPaths now supports dependency management and it works like a charm.

Yoann RodièreDecember 4, 2023 at 8:14 AM

thanks for the tip, that’s very useful! I’ll look into that.

Réda Housni AlaouiDecember 1, 2023 at 4:41 PM

Réda Housni AlaouiDecember 1, 2023 at 4:40 PM

FYI, it looks like Maven BOM support in annotationProcessorPaths is fixed by https://issues.apache.org/jira/browse/MCOMPILER-391 in maven-compiler-plugin 3.12.0 (not released yet).

Fixed

Details

Assignee

Reporter

Sprint

Fix versions

Priority

Created October 26, 2023 at 3:17 PM
Updated December 19, 2023 at 11:40 AM
Resolved November 17, 2023 at 2:14 PM