Gradle Hbm xml transform task

This is not a question but I just wanted to share my findings from using the TransformHbmXmlTask on gradle to convert .hbm.xml to .orm.xml files as the documentation seems to be limited currently and I just find a lot of confused users when I search

//build.gradle

import org.hibernate.orm.tooling.gradle.misc.TransformHbmXmlTask

plugins {
    ...
    id("org.hibernate.orm") version "6.6.40.Final" // replace version as appropriate
}

tasks.register("transformHbmXml", TransformHbmXmlTask) { 
    group = "hibernate"
    source = fileTree("path/to/your/xml/mappings") {
        include "**/*.hbm.xml"
    }
    it.renaming.get().prefix.set("")
    it.renaming.get().suffix.set("")
    it.renaming.get().extension.set("orm.xml")
    outputDirectory = file("generated/orm")
}

I hope this proves useful to someone!

1 Like

We’d be happy to accept a PR that adds information to the official documentation.

1 Like

Hi, I’ve created a PR but the check has failed because there is no HHH-number on the commits.

That’s fine, don’t worry. Thanks for the PR.

1 Like