cannot be opened because it does not exist,文件明明存在缺报文件不存在的解决办法(踩坑记录)

主要是因为idea默认只会编译.class文件而不会默认编译静态资源,需要在pom文件中指定

<build>    
    <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.doc</include>
                </includes>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
</build>

cannot be opened because it does not exist错误解决方法

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
这个错误通常是由于文件路径或文件名大小写不匹配导致的。根据引用\[1\]中的描述,你在application.yaml文件中配置了mybatis-config.xml的路径,但是大小写写错了。在调试时,由于操作系统对文件路径的大小写敏感,所以即使路径大小写不匹配,也会报错。但是在编译和调试过程中,IDEA会自动纠正路径大小写错误,所以不会报错。只有在运行打包完成的jar文件时,操作系统才会对路径大小写进行严格匹配,才会发现执行不了。 解决这个问题的方法是确保在配置文件中正确地写入mybatis-config.xml的路径,并且大小写要与实际文件路径匹配。另外,还要注意在使用maven进行clean和package时,确保文件路径的大小写是正确的。 希望这个解答对你有帮助! #### 引用[.reference_title] - *1* [运行jar包时报错:[mybatis-config.xml] cannot be opened because it does not exist](https://blog.csdn.net/weixin_44239774/article/details/127832230)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [idea中Web项目 class path resource [xxxx.xml] cannot be opened because it does not exist](https://blog.csdn.net/yaoyao9565/article/details/96991607)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值