Adding multiple Eclipse projects to Tomcat's classpath
4 comments
Comment from: Broc [Visitor]
Comment from: davidnewcomb [Member]
I thought I had cracked it when I found a clue to the above solution. However in my haste to blog I had forgotten that I have previously copied the other project’s class files into the correct place for another test! When I tried later to reproduce the solution I couldn’t get it to work. I left this blog up to provide another piece of the puzzle, in case someone else can find out how to do it.
Although there is a light, I was recently talking to Mark Thomas (lead contributor to the Apache Tomcat project) [sorry about the shameless name dropping] and showed him. After a lot of fiddling he agreed that this was the solution, but there was a bug in Eclipse and the class files should be copying across. We were on a tight deadline and needed to get something working and found that the easiest thing to do was keep the projects separate and jar up the other project’s classes and copy them into the WEB_INF/lib. Not an ideal solution, but at least you can run it in the debugger, hot recompiles are a bit flaky but it does the job.
So I think the relevant people have been alerted, but if anyone else has any suggestions on what the current work-around is then please, please, pretty please tell us how. So fingers crossed for the next release!
Comment from: davidnewcomb [Member]
Just in case you and I are the only people suffering from this, I’ve added a bug at Eclipse for this:
Running Tomcat in debug mode fails to deploy properly with multiple projects: https://bugs.eclipse.org/bugs/show_bug.cgi?id=259938
Comment from: Prashanth Menon [Visitor]
Form is loading...
This is precisely what I am trying to accomplish. I am actively developing two java projects that I would normally compile into jar files when I go to production. But I simply want Tomcat to see these extra projects in its classpath while I develop in eclipse.
Your above instructions seem to be the right solution, however, when I publish (or even do “Clean…") none of my classes are ever copied out to the tomcat directory. (e.g. to directory .metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MyWebApp\WEB-INF\classes)
I am using eclipse ganymede 3.4.1.
Any other tricks or configs I am missing?