First, let’s take a look at the standard directory structure of the MAVENx project:
Generally, the resource files we use (various xml , properties, xsd files, etc.) are placed under src/main/resources. When using maven for packaging, maven can package these resource files into the corresponding jar or war.
Sometimes, for example, the mapper.xml file of mybatis, we are used to putting it together with Mapper.java, both under src/main/java. In this way, when using maven to package, You 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 that src/main/java is just the source code path of java). There are many methods on the Internet. I tried it out, and several methods are available. You can choose any one.
Method 1, where **/* is written in order to ensure that resource files in subdirectories at all levels are packaged.
xml code
test src/main/java **/*.properties **/*.xml **/*.tld false
Method 2, using the build-helper-maven-plugin plugin
The above is the detailed content of Problems encountered when maven integrates the framework with mybaits. For more information, please follow other related articles on the PHP Chinese website!