I have a Kotlin based Spring Boot project with Hibernate. I use Gradle (version 7.4.2) as a build tool for the project. When I try to apply Hibernate plugin as follows, I end up with the below issue. All others plugins work fine. I have also tried different versions without any luck.
build.gradle
...
plugins {
id "org.springframework.boot" version "3.0.2"
id "io.spring.dependency-management" version "1.1.0"
id "org.hibernate.orm" version "6.1.6.Final"
...
}
Gradle build output:
Build file '/xyz/build.gradle' line: 11
An exception occurred applying plugin request [id: 'org.hibernate.orm', version: '6.1.6.Final']
> Failed to apply plugin 'org.hibernate.orm'.
> Could not create an instance of type org.hibernate.orm.tooling.gradle.HibernateOrmSpec.
> Extension of type 'JavaPluginExtension' does not exist. Currently registered extension types: [ExtraPropertiesExtension, SpringBootExtension, StandardDependencyManagementExtension, SourceSetContainer]
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
That error usually shows up when a plugin dependency is missing.
Try adding the Java plugin:
plugins {
id 'java'
[...]
}