-
Couldn't load subscription status.
- Fork 41.6k
Description
After upgrading from Spring Boot 2.2.5 to 2.3.0.M3 I found javax.persistence-api on the classpath, together with jakarta.persistence-api although only jakarta.persistence-api should be on the classpath.
It is possible that this behavior is a result of #19609.
This can be verified with the following minimal example.
Given the following build.gradle.kts:
plugins {
`java-library`
}
repositories {
mavenCentral()
maven("https://repo.spring.io/milestone")
}
val springBootVersion = "2.3.0.M3"
dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
}Running: ./gradlew dependencies --configuration runtimeClasspath shows that the classpath contains both javax.persistence-api:2.2 and jakarta.persistence-api:2.2.3.
runtimeClasspath - Runtime classpath of source set 'main'.
+--- org.springframework.boot:spring-boot-dependencies:2.3.0.M3
| +--- jakarta.persistence:jakarta.persistence-api:2.2.3 (c)
| +--- javax.persistence:javax.persistence-api:2.2 (c)
\--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.3.0.M3
+--- jakarta.persistence:jakarta.persistence-api -> 2.2.3
+--- org.hibernate:hibernate-core -> 5.4.12.Final
| +--- javax.persistence:javax.persistence-api:2.2
Whereas with Spring Boot 2.2.5.RELEASE the classpath only contains jakarta.persistence-api:2.2.3.
runtimeClasspath - Runtime classpath of source set 'main'.
+--- org.springframework.boot:spring-boot-dependencies:2.2.5.RELEASE
| +--- jakarta.persistence:jakarta.persistence-api:2.2.3 (c)
\--- org.springframework.boot:spring-boot-starter-data-jpa -> 2.2.5.RELEASE
+--- jakarta.persistence:jakarta.persistence-api:2.2.3
Bonus:
It is not possible to exclude javax.persistence-api manually, the result is still the same as without exclude.
dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}"))
implementation("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude(group = "javax.persistence", module = "javax.persistence-api")
}
}