-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add rule that prevents all dependencies to javax...
and early jakarta....
modules to be upgraded to a Jakarta version with the new package
#6
Comments
As discussed in the Gradle slack:
I adjusted the title of this issue. |
javax...
and early jakarta....
modules to be upgraded to a Jakarta version with the new package
Should probably do the following:
|
The rules now know which Jakarta version made the package change from 'javax' to 'jakarta'. Only the versions that have the same package as the corresponding Javax components are now in conflict. The rules setup follows the pattern for all rules. There is one rule per capability. So there are now sometimes two rules to detect conflicts between APIs and different implementations of a certain Javax/Jakarta component: - Javax...Rule (for javax capability) - Jakarta...Rule (for jakrata capability) Related to #6
I did some work here (released in The change is that now all A consequence of this is that sometimes there are now two rules, and with that two capabilities, you might need to consider or choose from. This is to cover other aspects like the conflict between and API and an implementation (e.g.
All rule implementations now strictly follow the pattern that there is one Rule Class per capability. And that class has a list of MODULES to which the corresponding capability is added. (And then there might be special handling, like just adding the capability to certain versions of some of the MODULES.) Regarding the original issue description Putting it differently: The idea that one component (with one GA coordinate) is always the same (just different version of the same thing) is hard-coded in the whole concept of how dependency resolution is done in Gradle (and in Maven as well). What was done here when the Jakarta components were released with this versioning, was just wrong from the Dependency Resolution perspective in the Grdle/Maven world and it cannot be fixed that easily with capabilities. There are other things one could consider, like rejecting versions as I wrote further up. Or one could maybe think of a clever way to replace the artifacts (the Jars) themselves or rewrite them with transforms. In my mind, this is beyond the scope of this plugin right now. Each solution would need to be generic enough to apply to (almost) all Java projects and that might be very hard to do. So if done, it would probably be good to do it in a separate plugin that folks can decide to use in addition to his one (or not). I'll keep this issue open for further discussion on that if someone is interested. I don't think I'll do anything more here for now, but I am happy to help if someone wants to work on something in this direction. |
I experimented with dealing with these Jakarta EE 8 artifacts (I can't imagine what folks were thinking, it'd have been much better if they'd waited for EE 9). I came to the conclusion it'd take variants attributes to cause them to conflict, which have really unfriendly error messages on conflict, so I punted on solving that, and just make sure we have a javax grouped artifact on the classpath. For JAXB specifically, I documented an option that allows both to exist here: I've also since published a plugin to help with projects making the leap to Jakarta EE 9, without it being a huge source migration: https://github.com/nebula-plugins/gradle-jakartaee-migration-plugin |
Given there has not been any activity here, we don't intend to do anything for the moment. |
If a project has conflicting dependencies on, say,
javax.xml.bind:jaxb-api:2.3.1
andjakarta.xml.bind:jakarta.xml.bind-api:3.0.0
, the plugin should let the conflicting capabilities fail the build. It currently selects thejakarta.xml.bind:jakarta.xml.bind-api:3.0.0
which is completely incompatible withjavax.xml.bind:jaxb-api:2.3.1
(one uses thejakarta
package, the other thejavax
one).Ideally, if a project has dependencies on
jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
andjavax.xml.bind:jaxb-api:2.3.1
, it should selectjakarta.xml.bind:jakarta.xml.bind-api:2.3.3
as both dependencies have compatible APIs (both use thejavax
package)If it's at all possible,
jakarta.xml.bind:jakarta.xml.bind-api:3.0.0
andjakarta.xml.bind:jakarta.xml.bind-api:2.3.3
should also be declared incompatible (jakarta
vsjavax
)The text was updated successfully, but these errors were encountered: