diff --git a/maven/pom.xml b/maven/pom.xml
index 2c75cd28dd..f42f9a0074 100644
--- a/maven/pom.xml
+++ b/maven/pom.xml
@@ -189,7 +189,7 @@
-
+
add-test-resource
generate-test-resources
@@ -205,6 +205,9 @@
**/hibernate.properties
+
+ src/functionalTest/resources
+
diff --git a/maven/src/functionalTest/java/org/hibernate/tool/maven/TransformHbmTestIT.java b/maven/src/functionalTest/java/org/hibernate/tool/maven/TransformHbmTestIT.java
new file mode 100644
index 0000000000..a276996338
--- /dev/null
+++ b/maven/src/functionalTest/java/org/hibernate/tool/maven/TransformHbmTestIT.java
@@ -0,0 +1,76 @@
+package org.hibernate.tool.maven;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.File;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Objects;
+
+import org.apache.maven.cli.MavenCli;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+public class TransformHbmTestIT {
+
+ public static final String MVN_HOME = "maven.multiModuleProjectDirectory";
+
+ @TempDir
+ private Path projectPath;
+
+ @Test
+ public void testSimpleHbmTransformation() throws Exception {
+ System.setProperty(MVN_HOME, projectPath.toAbsolutePath().toString());
+ writePomFile();
+ copyHbmFile();
+
+ runTransformHbmToOrm();
+ }
+
+ private void writePomFile() throws Exception {
+ File pomFile = new File(projectPath.toFile(), "pom.xml");
+ assertFalse(pomFile.exists());
+ Path pomPath = projectPath.resolve("pom.xml");
+ Files.writeString(pomPath, simplePomContents);
+ assertTrue(pomFile.exists());
+ }
+
+ private void copyHbmFile() throws Exception {
+ URL originUrl = TransformHbmTestIT.class.getResource("simple.hbm.xml");
+ assertNotNull(originUrl);
+ Path originPath = Paths.get(Objects.requireNonNull(originUrl).toURI());
+ File destinationDir = new File(projectPath.toFile(), "src/main/resources/");
+ assertTrue(destinationDir.mkdirs());
+ File destinationFile = new File(destinationDir, "simple.hbm.xml");
+ assertFalse(destinationFile.exists());
+ Files.copy(originPath, destinationFile.toPath());
+ assertTrue(destinationFile.exists());
+ }
+
+ private void runTransformHbmToOrm() {
+ File destinationDir = new File(projectPath.toFile(), "src/main/resources/");
+ File ormXmlFile = new File(destinationDir, "simple.mapping.xml");
+ assertFalse(ormXmlFile.exists());
+ new MavenCli().doMain(
+ new String[]{"org.hibernate.tool:hibernate-tools-maven:7.2.0.CR2:hbm2orm", "generate-sources"},
+ projectPath.toAbsolutePath().toString(),
+ null,
+ null);
+ assertTrue(ormXmlFile.exists());
+ }
+
+ private static final String simplePomContents =
+ """
+
+ 4.0.0
+ org.hibernate.tool.maven.test
+ simplest
+ 0.1-SNAPSHOT
+
+ """;
+
+}
diff --git a/maven/src/functionalTest/resources/org/hibernate/tool/maven/simple.hbm.xml b/maven/src/functionalTest/resources/org/hibernate/tool/maven/simple.hbm.xml
new file mode 100644
index 0000000000..c45e11bd01
--- /dev/null
+++ b/maven/src/functionalTest/resources/org/hibernate/tool/maven/simple.hbm.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file