Gangmax Blog

自由之思想,独立之精神

Maven Project Compling Error Hints in Eclipse

| Comments

A strange problem I meet today.

When I update a maven project(named A) by changing a pom.xml dependency(named B) version in Eclipse, a lot of compiling error hints of project A appear in Eclipse UI. However, I can execute “mvn clean install”(both in Eclipse or in command line) without any problem. So this is definitely an Eclipse problem.

After some investigation, I found this problem is related to the fact that, the project according to artifact B is opened in the same workspace as project A. It seems Eclipse RECORDED project B’s status. But the problem is: after I update project B to the latest version(as dependency of project A) and “mvn clean install” from Eclipse successfully, the compiling error hints in project A are still there! I also tried refreshing both of the projects and restarting Eclipse but they didn’t work. Finally I found if I close the project B in Eclipse, the error hints gone, Even if I opened the project B again.

I think this behavior of Eclipse(maybe m2 eclipse plugin, more specifically) is definite wrong: if you want to use the compiled classes in the same workspace to calculate the compiling problems, you should do refreshing/recalculating everytime when the complied classes change, not only when the project containing the classes is deleted from the workspace.

Comments