I'm currently looking at upgrading from IDEA 3.0.5 to 5 and it seems to me that the Tomcat integration in IDEA 5 isn't as tight as it was in IDEA 3. This causes us a few hassles and seems to lose us some functionality - of course, I may well be missing something! I'm using IDEA 5.0.1, Tomcat 5.0.28 and Java 5 update 5.
First some background: with IDEA 3.0.5 we had a run config that would run Tomcat using its server.xml which had two virtual hosts each containing a webapp in their root context. These webapps were both part of one IDEA project and their document roots/bases were in the project directory structure. While they were well-formed enough to be run as webapps by Tomcat (they each had WEB-INF subdirectories etc.) they did not contain all the jars they required because these were kept in a separate lib directory in the project. This was fine though, because we had the 'Include project classpath' tickbox ticked on the runtime configuration which made IDEA supply the project classpath to Tomcat.
The problem is that while IDEA 3 would run the actual tomcat bootstrap class and so could easily supply the project classpath, IDEA 5 seems to have moved away a level and just runs the catalina.bat file, so it can't supply the project classpath to tomcat any more. As I see it, we have three options:
1. Edit tomcat's setclasspath.bat file so that it includes the project classpath. Then it doesn't matter that IDEA can't supply the project classpath directly to tomcat. I don't like this option because firstly I want to keep a standard tomcat installation and secondly when the project classpath changes, setclasspath.bat would need to be changed by hand.
2. Use IDEA 5's feature of building a WAR or exploded web directory. I did try this but couldn't see how to package up individual files - only jars and directories. I want to put individual files in the WAR/exploded directory. In addition, our tomcat server configuration uses virtual hosts and IDEA doesn't seem to support this - you can only specify the context to deploy the webapp to. Also, this adds another step to the build process and the nice thing about our IDEA 3 setup was that the webapp was just ready to run.
3. Integrate Tomcat as an external tool. This is the option I have taken at present. Basically, it mimics the IDEA 3 tomcat integration in that the command line I've specified runs the tomcat bootstrap class using the project JDK and specifies the project classpath by using the $Classpath$ macro. This is the closest to what we want. There are only two downsides to it. Firstly, it's not as nicely integrated - when we want to debug, we have to run tomcat as an external tool and then connect to it using a 'Remote' runtime config session which is not as convenient. Secondly, I haven't been able to debug JSPs using this approach.
So, what I would love is basically what IDEA 3 gave us - a way to run webapps in tomcat virtual hosts straight from our project with no additional packaging required, tightly integrated with IDEA, including debugging. My question is, how can I achieve this? Can I enable JSP debugging somehow with option 3 above? Or am I missing something with option 2 that would let me achieve this (although I still don't like the extra packaging step). Any help would be appreciated.
I had a brief look at the JSR45 integration as it lets you specify package names for JSP's, but it didn't seem like this type of runtime config would buy me any tighter integration with tomcat than the tomcat server integration - which is unsurprising I guess!
I should say that I think IDEA is great and I've been a very happy user for a few years now. I love some of the new features and improvements that 5 has added. The webapp integration is really the only area that I haven't quite managed to configure to my satisfaction.
Sorry about the rather lengthy post - I wanted to be as clear as possible. Even so, let me know if I've left anything unclear or if more information would be useful.