Solution to Org.hibernate.mappingnotfoundexception:resource:**.hbm.xml not found problem in MAVEN project

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.