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!