spring-boot: JPMS: missing jakarta dependencies
So I currently have code that doesn’t directly use jakarta.transaction but a test is failing to start on missing it and modules for it and those modules for it. Some of these modules rely on modules I can’t lock using the spring bom.
So this is at least a request to add those modules to the bom so I can match versions properly.
This is jakarta.transaction module info but jakarta.enterprise:jakarta.cdi-api is not available in the bom. jakarta.interceptor:jakarta.interceptor-api is also missing.
module jakarta.transaction {
requires java.rmi;
requires transitive java.transaction.xa;
requires transitive jakarta.cdi;
requires jakarta.interceptor;
exports jakarta.transaction;
}
this is the maven pom from jakarta, which means these are expected to be provided by the consuming environment, and they are not marked optional. The version here is only for the consumer.
<dependencies>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
<version>2.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
edit: done with additional details in ticket
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (14 by maintainers)
We have a long-standing policy of only managing the versions of dependencies upon which we depend directly. This limits the scope of
spring-boot-dependenciesto something that is manageable and has served us well for several years.We don’t declare a direct dependency on
jakarta.enterprise:jakarta.cdi-apiorjakarta.interceptor:jakarta.interceptor-apiwhich is why they’re not managed. I’ve also checked the code and we don’t have any accidental usage of code in ajakarta.enterprise.*package or thejakarta.interceptorpackage where a direct dependency would then have been warranted.I don’t think we should change our policy to accommodate the JPMS. AIUI, the logical conclusion of such a policy change would be that we have to manage the versions of the entire transitive dependency graph. I don’t think that would be sustainable and we should decline this.
In addition to not wanting the scope of our dependency management to be unmanageable, as far as I can tell this is only a problem due to the oddities in the pom and module info of the transaction API.
The pom for
jakarta.transaction:jakarta.transaction-apideclares dependencies on bothjakarta.enterprise:jakarta.cdi-apiandjakarta.interceptor:jakarta.interceptor-apibut declares them as<scope>provided</scope>. This appears to be at odds with its module info which states that they’re bothrequired. It also marks thejakarta.cdimodule astransitivemeaning that it should be exposed to a module that only requiresjakarta.transaction. This mismatch between the pom.xml and themodule-info.javafeels like a bug to me. It may be possible to work around the bug with a component metadata rule in Gradle that changes the dependency scope fromprovidedtoruntime, but I think it should ultimately be raised with the maintainers of Jakarta Transactions so that they can consider aligning the dependency information in the module info and the pom.