首页 > 其他分享 >【BUG记录】Idea spring boot项目中target中没有同步更新最新目录文件及资源

【BUG记录】Idea spring boot项目中target中没有同步更新最新目录文件及资源

时间:2022-11-09 15:06:49浏览次数:69  
标签:java target spring boot bean springcloud com 目录


BUG 日志

可见是bean创建异常,依赖注入失败

org.springframework.beans.factory.BeanCreationException: Error creating 
bean with name 'buyServiceImpl': Injection of resource dependencies
failed; nested exception is org.springframework.beans.factory.
BeanCreationException: Error creating bean with name 'orderServiceImpl'
defined in file [D:\workspace\java\ideaworkspace\springcloud\seata-buy\target
\classes\com\xt\springcloud\service\impl\OrderServiceImpl.class]:
Post-processing of merged bean definition failed; nested exception is java.lang.
IllegalStateException: Failed to introspect Class
[com.xt.springcloud.service.impl.OrderServiceImpl] from ClassLoader
[sun.misc.Launcher$AppClassLoader@18b4aac2]

并且还打印了类的全路径信息

D:\workspace\java\ideaworkspace\springcloud\seata-buy\target\classes
\com\xt\springcloud\service\impl\OrderServiceImpl.class

因为我更改了这个项目的结构,这些文件都已经被我删除了
而日志里面的这个文件是先前项目编译的时候所生成的

【BUG记录】Idea spring boot项目中target中没有同步更新最新目录文件及资源_spring

target 目录介绍

项目编译后自动生成的项目文件,使用maven打包后的文件也会在此处。

解决方案

idea不会自动将新保存的文件或目录及其他资源更新到target目录中,必须在pom.xml中设置

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

<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
</build>

然后maven clean 一下,他会删除掉这个项目的target目录

【BUG记录】Idea spring boot项目中target中没有同步更新最新目录文件及资源_spring boot_02


重启一下项目,就会重新编译代码,生成新的target目录文件,就可以正常运行了

【BUG记录】Idea spring boot项目中target中没有同步更新最新目录文件及资源_java_03

References:

(写博客主要是对自己学习的归纳整理,资料大部分来源于书籍、网络资料、官方文档和自己的实践,整理的不足和错误之处,请大家评论区批评指正。同时感谢广大博主和广大作者辛苦整理出来的资源和分享的知识。)


标签:java,target,spring,boot,bean,springcloud,com,目录
From: https://blog.51cto.com/u_14020077/5836599

相关文章