I have a Kotlin + Spring Boot project that has org.springframework.boot:spring-boot-dependencies:2.5.7 as a dependency. spring-boot-dependencies already includes hibernate-jpamodelgen as a transitive dependency. But to actually be able to use hibernate-jpamodelgen in combination with kapt, I need a line like the following in my build.gradle: kapt 'org.hibernate:hibernate-jpamodelgen:5.4.32.Final'
.
So, in summary, my build.gradle file looks something like this:
plugins {
id('kotlin-kapt')
}
group = 'org.company.app'
description = 'stuff'
dependencies {
api(platform('org.springframework.boot:spring-boot-dependencies:2.5.7'))
kapt 'org.hibernate:hibernate-jpamodelgen:5.4.34.Final'
}
Now, the problem is that I always need to be careful to not mix up versions, for example, if I bump the spring-boot-dependencies, I must make sure that the kapt line also includes the version of hibernate-jpamodelgen included by spring-boot-dependencies.
This is, of course, error-prone, so I’m wondering how I can improve on that?
Maybe it’s somehow possible to get the version of a transitive dependency and then include that in the kapt
line in the build.gradle, or maybe there’s a completely different approach?
Thanks for any hints!