Eclipse project build takes a long time - eclipse

I'm working with a decent sized application (300-350MBs) in my Eclipse IDE. All is well, but when I modify a source file (i.e. MyServlet.java), I can't see any changes until I clean the project, which in turn runs a project build. Due to the size of my project, this build takes about 3-5 minutes.
I guess what I'm asking is if there's a faster way to update changes made to my source files, so that whenever I need to debug, I don't have to wait 5 minutes for every minor change.
What I've tried so far:
Restarting the server
Refreshing the project
Restarting Eclipse
Committing to the SVN
Clearing my browser cache

There is a dedicated tool for that: JRebel. Problem is that you need a licence.
But what you really need to do is to recompile changed class. In your case if this is a Servlet you also need to deploy it to server (+some servers support 'hot-deploy' and some don't, I.e. do you have to restart the server)

Related

Is it a waste of time to use "Build Automatically" option for Java projects in Eclipse?

I'm developing J2EE webapps in Eclipse (RAD, actually). I've always used the "Project > Build automatically" option. However, I noticed that this isn't always necessary because Eclipse seems to push out changes to my server when I save a file. This works great but I'm wondering why this would be checked by default.
I can think of a few times when it makes sense to fully build and deploy the app:
After changing a XML configuation file that gets loaded at app startup (application.xml, web.xml, bean configuration xml files, etc)
After changing a static variable on a class
Other than this, I can't think of other times when it would be crucial (or useful) to enable the build automatically option. Am I incorrect in my above assumptions? Am I just wasting a bunch of time by building automatically??
The automatic build compiles in the first-place. You can disable the automatic publishing (see screen) if you double-click on the server in the server-view. The automatic publishing has nothing to do with automatic build.

Skip validation and maven build on startup in eclipse

Technically I'm using Springsource Toolsuite, but I think this is a general eclipse question. My eclipse startup is now in the minutes, because on startup its running Maven Builder: FULL_BUILD and validation over all the open projects. I recently started working with a very large application, and going through the build and validation takes forever.
Is there a way to skip this at startup?
You can turn off automatic build under the Project top-level menu. Then you can explicitly control when to kick off a build. I would also ping m2eclipse guys on their forum about this issue. It sounds like there is a malfunction in their builder. It should not kick off a full build on every startup unless you workspace is significantly changed since the last Eclipse session.

Java maven development slow

I am developing a war/java website that is built via maven.
Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.
This is becoming very frustrating, so I have tried to speed up the deployment. I deployed the site via maven with war:exploded. Now, I edit the files live in 'deployed' format. The problem being I will need to move these changes back to the source location for pushing into our source control.
So has anyone written a script to 'undeploy' changes on the server carefully pointing them back to where maven expects them to be, or found another way I can instantly see my changes in a web browser. Rebuilding from source everytime is not a fun solution.
Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.
This is just a wrong way to use Maven in my opinion.
Either use something light like jetty:run (and hook Eclipse remote debugger to enable hotswap), see Configuring Jetty, Maven, and Eclipse together with Hot Swap.
Or use Eclipse WTP and deploy your project on a Tomcat server inside Eclipse (your project can be recognized as a Dynamic Web project whether you're using m2eclipse or the Maven Eclipse plugin).
Have you tried JavaRebel?
http://www.zeroturnaround.com/jrebel/
Use hot-deployment.
Just configure tomcat-maven-plugin and try tomcat:redeploy.

Incremental Publishing in Eclipse for Static Web Project

I have a static Web project added to an Apache server. Whenever I make a change to the project, regardless of how small the change is, the entire project republishes instead of the individual file. I was under the impression that the publishing process was supposed to keep a delta and only republish the files that have been marked as changed in the delta.
I wouldn't mind if the project were small, but it's a large project (200+ MB) and the connection to the server I'm publishing to is a bit slow. A republish takes anywhere between 15 minutes and a half hour.
Does anybody know if my install of Eclipse is working as expected?
Environment Specifics:
Eclipse Galileo
Aptana Studio Plug-in 1.5.1
Maybe you've found a bug. Try rsync instead.
There was a bug about delta publishing, but it should be fixed by now. And from other Eclipse projects, I assume that they added a test case for this, so it shouldn't happen again. But maybe your circumstances trigger a new bug.
Are you manually changing the files or do you use some script outside of Eclipse? Anything that makes Eclipse think the whole project has changed, will trigger a full redeploy.

Can I update the HTML files using Wicket and Eclipse without recompiling the classes?

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.
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.
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.
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.
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.
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.