idea 错误Caused by: java.io.IOException: Could not find resource com/xxx/xxx/xxx.xml的解决方法

  • Post author:
  • Post category:java




Caused by: java.io.IOException: Could not find resource com/xxx/xxx/xxx.xml的解决方法



错误原因:Maven静态资源过滤问题

由于使用的开发工具是idea dea中是不会编译src的java目录的xml文件 所以通常要配置maven才能编译src的java目录的xml文件



解决措施


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

配置maven之后错误就消失了!



版权声明:本文为qs_266原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。