views:

520

answers:

5

I'm using Eclipse and Maven-2 and I'd like to be able to edit my HTML files without "it" (not sure if it's Eclipse or Maven) recompiling my application. I understand that usually Eclipse tries to do a hot replace of new compiled Java classes with Eclipse and Tomcat.

Can I use something like this?

getResourceSettings().setResourcePollFrequency(null);

I know I can turn auto update off for Tomcat in Eclipse but I'd like the HTML file to update and the classes not to update if possible.

BTW, my primary concern is that Tomcat tends to get Perm gen errors after I (hot) reload too many java classes.

A: 

You may want to consider increasing the permgen space when you run eclipse. There is a command line argument:

eclipse [normal arguments] -vmargs -XX:PermSize=64M -XX:MaxPermSize=128M

(copied from:) http://wiki.eclipse.org/FAQ_How_do_I_increase_the_permgen_size_available_to_Eclipse%3F

I am not sure offhand how to prevent wicket from reloading HTML files but I will see if I can find it.

Edit: If setting the poll frequency to null doesn't work, try using Duration.MAXIMUM. Also, you can uncheck "Build Automatically" in the eclipse Project menu, though this is more of a hassle then it's worth, IMHO.

According to the wicket FAQ, wicket only reloads changed markup files when you explicitly set the resource poll frequency:

http://www.wicketframework.org/faqs.html

I am not sure how to prevent eclipse from copying altered files to the output aside from disabling build automatically.

RMorrisey
A: 

If Build Automatically is enabled (it is by default: Project->Build Automatically) then any modification to the project files will trigger the build, regardless of whether they are in source folders or not.

I always work with Build Automatically disabled as I find it too intrusive (for reasons like this), and just hit ctrl-B when I want the project to build, or alt-P N to launch the clean dialog if needed.

Rich Seller
A: 

I understand you're using (and might want to keep using) Tomcat, but during Wicket development you can run the supplied Jetty server onder /src/test/java/com/your/package/Start.java in debug mode to get this behaviour.. Set Wicket to development mode to use this feature.

Tim
A: 

HTML files or jsp files?

Are you using tomcat? If you are editing only html files, go ahead and change them as you wish. As long as you don't deploy them somewhere else for tomcat to fetch them, you'll see the update(s).

If it's jsp, save your new file, delete the files under the old work folder. This will make tomcat think it's the first time the file is requested and it will re-compile the jsp on the fly.

vinnybad
Context of this question is Wicket which does a lot of special things with HTML files (which live in the same packages as corresponding Java classes).
Esko
+1  A: 

You're sort of correct, you're supposed to use setResourcePollFrequency(Duration.ONE_SECOND); or similar. This link has more detailed information. However what I've found is that due to Wicket's caching internal cache containers like to get really messed up after any hotswapping so you may just have to learn the hotkey for restarting Tomcat or start doing Wicket development with the integrated Jetty and WicketTester.

Esko