|« Japanese Tour Day 1||7-Zip's context menu doesn't work under Vista »|
Invoking 'Spring Project Builder' on '/project' hangsMarch 1st, 2010
I’ve been using SpringSource Spring Tool Suite (STS) for a while now. It’s pretty good. One of the problems with Eclipse is maintaining all the dependencies for web development and thankfully the chaps at SpringSource take care of all that for you.
I only have 2 grumbles with the current version of STS (2.3.0.RELEASE):
- When you try to save a file, it kicks off the Spring Project Builder first (i.e. before the actual save takes place).
- The Spring Project Builder appears to hang for quite a while (minutes).
The first problem isn’t too bad except for the fact that we use an external (to STS) build process so we have to hang around for an age before we can kick it off.
The second problem was destroying my life. Imagine coding for 5 minutes, and then waiting for 3 minutes all day long. Sometimes you might only be coding for 1 minute! STS will occasionally just decide to run the Spring Project Builder for no reason so you are hanging around again. It might be ok if you could continue coding while the builder is doing it’s thing but you can’t. Clicking anywhere in the STS window makes the menu bar disappear - it really looks like it has hung. Then 3 or 4 minutes later it springs back into life (if you’ll pardon the pun!). There is nothing you can do except get another coffee, so by the end of the day you are panicking because you haven’t done all your work and so wired you can’t think straight.
If you get a stack trace of Eclipse at the time of the hang you will see something similar to:
"pool-1-thread-29" prio=6 tid=0x4f244c00 nid=0x1220 runnable [0x4c5ce000] java.lang.Thread.State: RUNNABLE at java.util.zip.ZipFile.getNextEntry(Native Method) at java.util.zip.ZipFile.access$400(ZipFile.java:29) at java.util.zip.ZipFile$2.nextElement(ZipFile.java:313) - locked <0x04197f10> (a java.util.jar.JarFile) at java.util.zip.ZipFile$2.nextElement(ZipFile.java:299) at java.util.jar.JarFile$1.nextElement(JarFile.java:223) at java.util.jar.JarFile$1.nextElement(JarFile.java:218) at org.springframework.ide.eclipse.core.io.ResourceUtils.addJarEntryResources(ResourceUtils.java:389) at org.springframework.ide.eclipse.core.io.ResourceUtils.getResourceForProject(ResourceUtils.java:358) at org.springframework.ide.eclipse.core.io.ResourceUtils.getResource(ResourceUtils.java:290)
The problem is in the builder. It is re-scanning all your jar files and working out if everything is ok. The more jars you have the longer it takes. I understand that the root cause of the problem is the algorithm for resolving <import>’s (when parsing the XML in the WEB-INF configuration) which is not clever at all.
The trouble with SpringSource is that they don’t release any dates on when things are due to be released. “It’ll be ready, when it’s ready” just doesn’t cut it when it comes to planning production environments. You have to start using what there is available in order to get all the testing done in time for our release date. We don’t get the chance to keep adding delays. I digress.
Fear not friends, there is a solution, you can switch off the Spring Project Builder. It is a per project thing so you have to do it for all projects but it’s no biggie.
- Select the project in the Package Explorer.
- From the menu bar select Project->Properties
- From the left hand list select Builders.
- Uncheck Spring Project Builder.
- Click Ok.
So far I have not noticed any difference between having it switched off (as opposed to switched on) except that STS no longer hangs for 3-4 minutes every 3-4 minutes!
Spring Project Builder and STS in general is utter shit
I think that’s a little harsh. The good thing it does is produce an Eclipse with everything you need to write JEE applications. The Eclipse JEE doesn’t have any stuff to represent your object model graphically like STS does. STS also contains a lot of the stuff that you would normally have to download and install yourself. I’ve tried this before and you just get into dependency hell. You can be sure that everything that comes in that version works together.
I wrote the article when I was using STS 2.3. They are now on STS 2.6 which uses the Eclipse 3.6.2 platform.
So let’s hope it’s better!
Seriously man, you saved my life .. STS was giving me hard time for last 6 months … i was going nuts with hanging and slowness w/ 4GB RAM and SSD … you saved me bro … i disabled everything in Builders … damn it
Thank you! This is STILL an issue - running v. 3.4