Could not find resource*

在使用Mybatis框架写java代码时,发现总是报错
错误信息
首先检查了mapper文件,没有发现错误,最后看到
Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource xxx.
才发现是pom文件中resource导致的找不到xml文件:

    <resources>
      <resource>
        <directory>src/main/java</directory><!--所在的目录-->
        <includes><!--包括目录下的.properties,.xml 文件都会扫描到-->
          <include>**/*.properties</include>
          <include>**/*.xml</include>
        </includes>
        <filtering>false</filtering>
      </resource>
    </resources>

配置以后,一定重新加载Maven,然后就没问题了。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐