Forwarding Address http://www.cnblogs.com/liuzy2014/p/5981824.html
In general, the resource files we use (various xml,properites,xsd files, etc.) are placed under Src/main/resources, and MAVEN can package these resource files into the appropriate jar or war using MAVEN. Sometimes, such as MyBatis's Mapper.xml file, we used to put it and Mapper.java together, all under the Src/main/java, so using maven packaging, You will need to modify the Pom.xml file to package the Mapper.xml file into a jar or war, otherwise these files will not be packaged. (Maven thinks Src/main/java is just Java's source code path). There are many methods on the network, I probably tried, several methods can be, can choose one. Otherwise, the war package is not mapper.xml. Method 1, where **/* is written in order to ensure that the resource files under all levels of subdirectories are packaged. XML code Collection Code <build> <finalName>test</finalName> <!--This also allows you to package all of your XML files into corresponding location. <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> &L T;include>**/*.xml</include> <include>**/*.tld</include> </i Ncludes> <filtering>false</filtering>--filtering is to indicate that the configuration file includes ${} This dynamic change should not be replaced by a true value, true means replacement, and WillThe file is packaged. False indicates no substitution. But once the include is written, it will certainly include the configuration file into the war </resource> <resource> <directory> ;src/main/java</directory> <includes> <include>**/*.properties< /include> <include>**/*.xml</include> <include>**/*.tld< /include> </includes> <filtering>false</filtering> < ;/resource> </resources> </build>
Maven Packages The configuration files in Java