Using the gradle plugin

There seems to be a hibernate tools gradle plugin available but there is very little information on how to use it and no plugin artifact published to the official gradle plugins repository. Does anyone know how to use the gradle plugin and share an example? Thanks!

The official Hibernate ORM documentation contains a section about the plugin: Hibernate ORM User Guide
Do you have a more specific question?

Thanks for your response!

The user guide section you linked seems to be about the ORM gradle plugin. I’m looking for the Hibernate Tools Gradle Plugin that allows for features such as reverse-engineering. I tried importing the Hibernate ORM plugin as shown in the user guide and they appear to be different plugins.

The Gradle plugin is just a wrapper around the Java code for these generation tasks, similar to the Maven and Ant plugins. You can refer to e.g. the Maven Plugin description for some docs: hibernate-tools/maven at main · hibernate/hibernate-tools · GitHub

We’d very much appreciate if you want to contribute back some docs for the Gradle plugin based on the Maven plugin docs.

It’s true that the reverse engineering Gradle plugin is not published on the plugin portal and that the documentation is seriously lacking. There is a scheduled task to solve this: Jira.
In the meantime, you can use the Maven GAV and inherit from the defined classes to use them in your own projects. In the integration tests you should be able to find indications on how to use them. Sorry for the inconvenience but we are working on it!

I managed to use the plugin by directly adding the as a build script dependency from maven central, where it is published just like the other components.

Here is an example for Gradle Kotlin:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.hibernate.tool:hibernate-tools-gradle:6.6.9.Final")
        classpath("org.mariadb.jdbc:mariadb-java-client:2.7.3")
    }
}

apply(plugin = "org.hibernate.tool.hibernate-tools-gradle")

Thanks for contributing your solution!