这几天被这个问题快折腾死了,新写的类方法明明有就是说找不到。最终定位到问题原因:在run项目时如果你是组合项目。也就是有两个或者多个project之间相互依赖。运行时需要勾选“resolve workspace artifacts”这个选项。作用是
Assume you have two or more projects in your workspace e.g.project1,project2and so on. Ifproject1is dependent onproject2andproject3, you just need to define the dependency ofproject1onproject2andproject3.
By enablingResolve Workspace Artifacts,m2Eclipsewill auto-build theSNAPSHOT JARofproject2andproject3and add in the classpath ofproject1.
In other words, it resolves the dependencies with workspace projects.
以上是引用stackoverflow
大概意思就是多项目互相依赖需要一起打包编译,所以勾选“resolve workspace artifacts”
配置截图:
配置maven的地方
网友评论