# Using the gradle plugin

**URL:** <https://discourse.hibernate.org/t/using-the-gradle-plugin/11191>\
**Category:** Hibernate Tools\
**Created:** [March 11, 2025, 6:16pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191 "2025-03-11T18:16:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcmdev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mcmdev/32/3898_2.png) [@mcmdev](https://discourse.hibernate.org/u/mcmdev)\
**Post date:** [March 11, 2025, 6:16pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/1 "2025-03-11T18:16:41Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [March 12, 2025, 1:03pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/2 "2025-03-12T13:03:26Z")

</div>

The official Hibernate ORM documentation contains a section about the plugin: [Hibernate ORM User Guide](https://docs.jboss.org/hibernate/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#tooling-gradle)  
Do you have a more specific question?

---

<div class="post-metadata">

**Author:** ![mcmdev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mcmdev/32/3898_2.png) [@mcmdev](https://discourse.hibernate.org/u/mcmdev)\
**Post date:** [March 12, 2025, 1:40pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/3 "2025-03-12T13:40:34Z")

</div>

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](https://github.com/hibernate/hibernate-tools/tree/main/gradle) 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.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [March 12, 2025, 3:24pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/4 "2025-03-12T15:24:18Z")

</div>

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](https://github.com/hibernate/hibernate-tools/tree/main/maven)

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

---

<div class="post-metadata">

**Author:** ![Koen\_Aers](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/koen_aers/32/27_2.png) [@Koen\_Aers](https://discourse.hibernate.org/u/Koen_Aers)\
**Post date:** [March 12, 2025, 4:40pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/5 "2025-03-12T16:40:09Z")

</div>

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](https://hibernate.atlassian.net/browse/HBX-2968).  
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!

---

<div class="post-metadata">

**Author:** ![mcmdev](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/mcmdev/32/3898_2.png) [@mcmdev](https://discourse.hibernate.org/u/mcmdev)\
**Post date:** [March 13, 2025, 6:49pm UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/6 "2025-03-13T18:49:36Z")

</div>

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:

```auto
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")

```

---

<div class="post-metadata">

**Author:** ![Koen\_Aers](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/koen_aers/32/27_2.png) [@Koen\_Aers](https://discourse.hibernate.org/u/Koen_Aers)\
**Post date:** [March 20, 2025, 11:09am UTC](https://discourse.hibernate.org/t/using-the-gradle-plugin/11191/7 "2025-03-20T11:09:43Z")

</div>

Thanks for contributing your solution!
