The configuration file in the Maven project cannot be found or packaged. The maven configuration file

Source: Internet
Author: User

The configuration file in the Maven project cannot be found or packaged. The maven configuration file

When we use maven to develop a project, a resource directory is automatically created during model creation. This directory is used to store configuration files, we put the configuration file in this directory to package the project.

Sometimes we put the configuration file in the java file directory, but the configuration file will not be packaged in this way; if it is not packaged in, it will certainly report that the configuration file cannot be found, in this case, we need to add the configuration in the pom configuration file:

<Build>
<Resources>
<Resource>
<Directory> src/test/resources </directory>
<Shortdes>
<Include> **/*. xml </include> // pack all configuration files ending with. xml.
<Include> **/*. dic </include>// Set all.DicPackage the configuration file at the end
<Include> **/*. properties </include>// Set all.PropertiesPackage the configuration file at the end
// All configuration files can be configured here as above

</Shortdes>
</Resource>
</Resources>
</Build>
Add this configuration in the build tag of the pom file so that the configuration file will be packaged with the code!

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.