Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource pers.zhb.dao/StudentMapper.xml

1、在运行maven书写mybatis的项目,对项目进行测试的时候出现如下错误:Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource pers.zhb.dao/StudentMapper.xml

已经检查了配置文件的路径,并未发现错误,但是提示文件找不到

 

2、解决方法

在父模块和子模块的配置文件中添加如下代码(在bulid中配置resources,防止资源导出失败的问题)

<build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

 

posted @ 2020-04-24 22:55  怀梦想,致远方  阅读(1294)  评论(0编辑  收藏  举报