문제

I have a mavenized project with dependencies upon 4 others mavenized projects that my team is currently working on. We have "workspace resolution" enabled.

If I publish to Tomcat, jars are not available for the 4 projects so I see all sorts of NoClassDefFoundError exceptions. I don't see any problems with JUnit testing or packaging. (I run the package goal and the resulting war file includes the SNAPSHOT jars that I expect.)

I see a lot of people advocating for using workspace resolution, but if we need to test in Tomcat should we disable this? Or what else might I be missing?

We use Eclipse Helios, the m2eclipse plugin, Maven 3.0.3. I even installed m2extras to see if that helped, but I didn't see any difference.

Thanks

도움이 되었습니까?

해결책

You can get this setup to work (we have been working with the same toolchain and setup here) if you can live with some manual refreshes, after you have been using m2eclipse goals to build.

The problem is, that not all external changes via m2eclipse builds to workspace projects are synched correctly to your deployed web application in tomcat.

So if you are experiencing NoClassDefFoundError exceptions after building via m2eclipse the following should help (not all are necessary everytime):

  • Do a Project/Clean on your maven projects
  • Do a Refresh (F5) on your maven projects
  • Clean the deployed web application (Server Context menu)

Yes, it is cumbersome but one can live with it.

다른 팁

  1. Remove the dependency project from the workspace.
  2. Delete .settings directory and .project files.
  3. Import the project again.
  4. Update maven dependencies in all projects.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top