码迷,mamicode.com
首页 > 其他好文 > 详细

Could not find resource

时间:2021-05-24 16:01:13      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:文件   编写   lang   includes   des   pre   添加   测试   mapper   

Maven测试Mybatis出现Could not find resource报错

1.注意Mybatis核心文件的编写

官网

<mappers>
    <mapper resource="org/mybatis/example/BlogMapper.xml"/>
</mappers>

改写成自己

<mappers>
    <mapper resource="com/yeyu/dao/UserMapper.xml"/>
</mappers>

注意:不再是com.yeyu.dao,把(.)改写成(/)

2.在pom.xml中添加以下配置

<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>

Could not find resource

标签:文件   编写   lang   includes   des   pre   添加   测试   mapper   

原文地址:https://www.cnblogs.com/yeyu2000/p/14784375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!