Fix MAVEN Project Unable to read configuration file under Src/main/java directory problem

Source: Internet
Author: User

When we use MyBatis to operate the underlying database, we need to use the XML configuration file, generally we put the configuration file and DAO in the same directory.

However, when using idea to manipulate the MAVEN project, we may encounter a mapper.xml file that cannot be read to the DAO.

The simple solution is as follows:

The first type:

Move the XML file to Src/main/resource below, this is the most convenient, but faced with a problem, it seems that the overall structure of the project is not clear, not unified, the hierarchy is not good, then we look at the second kind.

The second type:

We need to configure in the Pom.xml file, so that when the project starts to read to Src/main/java the following configuration file, as below, add the following code in the Pom.xml:

  

<Build>      <Resources>          <Resource>              <Directory>Src/main/java</Directory>              <includes>                  <include>**/*.xml</include>              </includes>          </Resource>      </Resources>  </Build> 

Fix MAVEN Project Unable to read configuration file under Src/main/java directory problem

Related Article

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.