Java IDEs and Web Development
Why does every Java IDE that supports Web development force the structure of your coding artifacts on disk to be the same as a war file? To my mind it is an extremely un-user friendly structure. I’ve just been looking at the latest copy of Webtools for the Eclipse IDE and it is no different.
Take a look at the attached screen shot to see what I mean.

Now not only does it force me to keep everything so it is diplayed in the horrible war file format, but because of this is doesn’t leave me anyway to organise my extraneous artifacts. I mean what the hell does WEB-INF mean to anyone intuatively? Do I have to dump all my hibernate configuration with my log4j configuration with my application configuration and my urlfilter configuration, quite quickly we are going to end up with a mess of crap in the classes directory. Where as I would like to have a configuration directory with subdirectory for each component that needs configuration files.
Where do I put my unit tests? Where do I put classes and jars that I depend upon at compile time but not at runtime, for example JAXB compiler jar files. I could have them as “external jars” but that stops my web project being self-contained, I like my projects be self contained. I want to checkout from source control and be able to compile without spending two weeks tracking down dependancies.
The solutions to my mind is fairly simple, some form of mapping needs to be allowed that enables you to declaritively instruct the IDE what should be where for the war but still allow you to structure things in the way you wish. This is what I usually do with ant but Eclipse isn’t yet clever enough to understand my ant file.
So although I’ll be evaluating Webtools some more I’m immediately turned off by it.
March 29th, 2006 at 4:29 pm
Use an ANT build file to create the WAR, and keep the resources in whatever format you feel comfortable with.
My projects get seperated into functional areas, with the various config files seperated into meaningful locations, the ant files lobs them all into a jar, and combines this into the war file.
This also means you have a one-click cross-platform deployment.
Dave
March 29th, 2006 at 5:20 pm
One reason is that you can point Tomcat (and other appservers) to the war layout in your IDE workspace, and it will reload classes as you recompile them, with no need to re-build the .war archive.
With that, you don’t have to redeploy to see changes.
March 30th, 2006 at 6:54 am
Yes, I want to have the IDE/app server understand the meaning of the files, be able to reflect changes in java files and configuration files and NOT have to have them set out in the WAR/EAR file structure.
Your ant suggestion does not achieve this.
March 30th, 2006 at 10:22 am
Have an ant task copy the files to the relevant location after they are modified? It doesn’t really seem like such a difficult problem.
March 30th, 2006 at 3:28 pm
“Have an ant task copy the files to the relevant location after they are modified? It doesn’t really seem like such a difficult problem.”
And this allows me to set break points, step through code running on the application server and use JSP WYSIWYG editors does it? No it doesn’t. The IDE has no clue of the meaning of the various XML files needed to run the application within the context of the IDE.