My pom.xml is as follow:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Test</groupId>
  <artifactId>Hibernate_Reveng_Maven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Hibernate Reveng Gen Java</name>
  
  <properties>
      <project.basedir>C:/Kei/SLIS_git_eclipse_2023_09_20231115_2/Hibernate_Reveng (Not work) </project.basedir>
    <h2.version>1.4.200</h2.version>   
    
  </properties>
  
  <build>
      <plugins>
        <plugin>           
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools-maven-plugin</artifactId>
            <version>5.4.29.Final</version>         
            <executions>
                  <execution>
                    <id>entity-generation</id>
                    <phase>generate-sources</phase>
                    <goals>
                      <goal>hbm2java</goal>
                    </goals>
                    <configuration>
                      <ejb3>true</ejb3>
                      <revengFile>${project.basedir}/src/main/resources/reveng.xml</revengFile>
                    </configuration>
                  </execution>                
        </executions>   
        <dependencies>
            <dependency>
                <groupId>com.oracle.database.jdbc</groupId>
                <artifactId>ojdbc8</artifactId>
                <version>12.2.0.1</version>
            </dependency>
        </dependencies>     
      </plugin>      
      </plugins>
    </build>
    
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools-maven-plugin</artifactId>
            <version>5.4.29.Final</version>
        </dependency>           
            <!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
         <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>12.2.0.1</version>
        </dependency>
    </dependencies>
</project>

My hibernate.properties is as follow and is placed in src/main/resources:

hibernate.dialect=org.hibernate.dialect.Oracle12cDialect
#hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
hibernate.connection.url=jdbc:oracle:thin:@10.9.xxx.xx:25100:dsli01.xxxxx.com
hibernate.connection.username=dsli01
hibernate.connection.password=xxxxxx

My reveng.xml is placed in src/main/resources and is as follow:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC 
  "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" 
  "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
  <!-- This assumes your database connection is pointing to the proper catalog -->
  <!-- To get all tables in the named schema, use the following 
       <schema-selection match-schema="PM" />
  -->
  <!--  to get only the named tables -->
  <schema-selection match-schema="dsli01" match-table="UAC_USER_SSN"/>
  
</hibernate-reverse-engineering>

then when I run mvn clean install, the following error is shown:

[ERROR] Failed to execute goal [32morg.hibernate:hibernate-tools-maven-plugin:5.4.29.Final:hbm2java[m [1m(entity-generation)[m on project [36mHibernate_Reveng_Maven[m: [1;31mExecution entity-generation of goal org.hibernate:hibernate-tools-maven-plugin:5.4.29.Final:hbm2java failed: Could not configure overrides from file: C:\Kei\SLIS_git_eclipse_2023_09_20231115_2\Hibernate_Reveng (Not work)\src\main\resources\reveng.xml[m: invalid override definition: Element type "hibernate-reverse-engineering" must be declared. -> [1m[Help 1][m
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[ERROR] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

what is the error means? And I see my reveng.xml has element

<hibernate-reverse-engineering>
........
</hibernate-reverse-engineering>
1

There are 1 best solutions below

0
user1169587 On

Capricorn1 answer in Hibernate mapping recently failing with SAX parser exception: element "hibernate-mapping" must be declared solved my problem. That is, modify the DOCTYPE in the hibernate.reveng.xml file.

Anyway, What is the origin problem come from and why above can fix the issue is unknown yet.