Skip to content
Print

WTP’s Crazy (and undocumented) Setting Change

12
Oct
2007

I’ve been working recently on a Wicket-based project for a company called Teachscape.  Not only is it based on Wicket, but the project is also designed to be run within Jetty, as opposed to the traditional Tomcat or Glassfish deployment.  This makes local development a lot easier to handle, since you just fire a main-class (which instantiates and starts Jetty) and away you go.  Well, theoretically anyway…

Since it’s a Wicket-based project, all of the HTML files are thrown in with the Java sources and must be on the classpath along with the compiled classes.  The problem is, lately my copy of Eclipse wasn’t doing that properly.  Other Wicket projects on my system (using WTP) still seemed to work fine, but the Jetty-based project just didn’t want to run.  It kept complaining about not being able to find the markup for a specific page.  This is Wicket’s way of telling the developer that they probably forgot a HTML file somewhere.

Now I was able to manually verify that the file did exist in the appropriate directory, named correctly.  It was in an Eclipse source dir which had no exclusion or inclusion rule which would exclude it (either explicitly or implicitly).  In short, it should be on the classpath.  Being savvy to Eclipse’s occasional classpath oddities, I fired a quick clean of the project and tried again.  No luck.  My next step was to do a clean checkout, re-gen the project meta files using Maven, and finally build and run.  Once again, no dice.  This was when I decided to spelunke a bit into the actual build output directory for the project.  When in doubt, check it out by hand, right?

It turns out that none of the HTML files for any of the pages were being copied to the target directory.  I found this more than a little odd, since I knew it was working before and (as I said) none of the source filters should have excluded anything.  So I went in and changed the filters so that only **/*.html files should be included in the build.  The result?  An empty target directory.  Not encouraging.

I tried copying over configurations, editing the .classpath file directly, even looking at the help documentation for JDT, still no luck.  It was the first problem I’ve had with Eclipse in years which I haven’t been able to solve reasonably quickly or work-around.  In short, I was stuck.

Out of sheer desperation, I started browsing through some of the Eclipse JDT and WTP preferences.  I figured that WTP had to have something to do with all of this, since the builder was obviously treating HTML files in a special way and WTP is the only plugin I have installed which might do that.  I came up empty on the WTP front, but when looking through the JDT builder prefs, I found this nugget:

wtp-screwup

What?!  I honestly cannot think of any valid reason why I would want those resources excluded.  WTP doesn’t require it.  After removing these two lines (SVG files probably should be included in the build too), all of my WTP projects still run fine.  In fact, since this preference was obviously added by WTP, it got me thinking: all of this worked fine not two days ago, what happened?

The answer is: I updated WTP.  It seems the latest update of Eclipse WTP adds this preference into your JDT settings whether you want it or not.  Not only that, but there seems to be no warnings, no documentation of any kind which would indicate its purpose or that it even made the change!  I ask you: why was this necessary?

I lost literally hours of time trying to track this down.  Granted, if I was more familiar with the “Output folder” preferences in the JDT compiler settings, maybe I would have figured it out sooner.  But the point is not my less-than-perfect familiarity, the point is that this change seems to require the developer to have advanced knowledge of the Eclipse preference system, just to track down an apparent bug in their own project config.  Bad move, WTP, very bad.

…now that the flames have died down: what is the purpose behind the exclusion of these resources anyway?  If they don’t hurt anything in a WTP project, and they certainly wouldn’t mess with anything in a Java project, why exclude them?  Also, in all fairness I really don’t know for certain that it was WTP that made the change.  I updated the entire Europa train at the same time.  Theoretically, any one of the projects could have made the undesirable modification.  WTP just seemed the most likely since one of the exclusions was *.html, though PDT would be an equally valid guess.

Comments

  1. For what is worth, I use WTP and updated to the latest Europa maintenance release without seeing that problem. Maybe it was something else.

    Ismael

    Ismael Juma Friday, October 12, 2007 at 9:48 pm
  2. congrats on the teachscape job :)

    Gerolf Seitz Saturday, October 13, 2007 at 3:52 am
  3. Nice post. It happed to me and this blog entry saved me some time. Thanks!

    Mauricio LopezSoto Wednesday, November 28, 2007 at 12:17 am
  4. I have been through to the same issue like this. With Eclipse WTP Ganymede and Tomcat 6. I have my spring project running in MyEclipse and working fine and want to test with WTP checked out from svn. for few days it was working fine and after those few days it stopped deploying my *.hbm.xml files. These files must be in the class path and was working fine previously. I downgraded the WTP from Ganymede to Europa and its working fine now.

    Kashif Ur Rehman Sunday, November 23, 2008 at 11:19 pm

Post a Comment

Comments are automatically formatted. Markup are either stripped or will cause large blocks of text to be eaten, depending on the phase of the moon. Code snippets should be wrapped in <pre>...</pre> tags. Indentation within pre tags will be preserved, and most instances of "<" and ">" will work without a problem.

Please note that first-time commenters are moderated, so don't panic if your comment doesn't appear immediately.

*
*