Just started to learn maven, the learning process encountered a lot of problems, especially the use of Eclipse to create MAVEN project, Real TM egg pain ...
Follow the online tutorial to create a MAVEN project and look at the project structure:
Please note that my profile is not placed under the Src/main/resource folder.
The result will be an error after running:
Org.hibernate.mappingnotfoundexception:resource:**.hbm.xml not found.
On-line search for a half-day data, originally for MAVEN project, compiled work is done by Maven program, and maven by default will only copy files under the Src/main/resources folder to the Target/classes folder, so the red box up The . Hbm.xml will not be copied to the/target/calsses folder, so the Hibernate framework will not be able to find the *. Hbm.xml error when it is running.
Solution:
In Pom.xml, explicitly tell maven what resource files are copied to the Target/classes folder.
The following code:
<build> <resources> <resource> <directory>Src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <filtering>True</filtering> </Resource> <resource> <directory>Src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> </Resource> </Resources></Build>
Related issues: Maven project compiled class file does not have an. xml file problem.
Solution to Org.hibernate.mappingnotfoundexception:resource:**.hbm.xml not found problem in MAVEN project