Reducing Working Code Size

8 01 2008

How many of us load the whole of the Sakai Code base into eclipse, and wonder why it consumes so much memory? Most I guess. Alternatively you can just load the code you are working on and just use the local maven repo for the Sakai jars, that way eclipse will run in considerably less memory. When you need to access the source code, if the repo has the source jars, then they can be used instead of the live code base. Obviously this doesn’t allow you to edit all any code anywhere…. but then should we all be doing that anyway… except for those rare debugging exercises.

I did the above for search, editing the .classpath file for eclipse and now I can just work on search with all the other projects close. Eclipse memory usage has dropped from 1G to closer to 128M. Once we package the core (bin and src) into a maven repo, its going to make sense to use this approach. Fortunately maven has support to help us.

Advertisements

Actions

Information

7 responses

8 01 2008
Jason Shao

Sounds wonderful to me — if we could check out just a project and mvn eclipse:eclipse build a classpath that referenced all the right dependencies as repo jars with attached source, that seems like it’d be almost ideal — especially as we move to less and less people having global commit anyway.

8 01 2008
casey dunn

neat idea!

Can one set breakpoints in the ‘remote’ source jars? I’ve found it helpful at times to trace issues down from odd entry points such as portal code.

Some mechanism to easily swap between MAVEN_REPO paths and local source checkout paths would be handy.

8 01 2008
Ian Boston

Yes, as long as you have the source you can…. in fact… even if you don’t have the source you can set break points on entry to a method, load of the class or when an exception is thrown. One thing to watch which the source is that it matches the binary, and the binary has been built with debugging information, which nearly all are.

Switching is a bit harder, but it might be possible to have an xslt to run on the .classpath files and then its just a refresh in a running eclipse.

6 02 2008
Carl Hall

I love the idea of Eclipse using less memory. By having only the code you want to work on, how do you setup your folders outside of Eclipse so you can run a maven build?

7 02 2008
Ian Boston

If you have a maven build, then all you need to do is mvn eclipse:eclipse and it will generate the eclipse project and classpath files for you. It saves a massive amount of time.

You still need to create the project pom.xml’s to drive the maven build… I am not certain if that is what you were asking for ?

13 02 2008
Carl Hall

Sorry, I missed that projects are closed. I thought you excluded them from your source directory.

Have you tried the m2 plugin for eclipse? It automatically sets up your maven dependencies as a referenced library to the project.

14 02 2008
Ian Boston

I have tried it a few times, but in general I find the maven pom file as a more ‘official’ set of dependencies, since dependencies in listed in eclipse don’t know anything about transitive dependencies, so you can frequently end up adding more dependencies to the pom than is necessary.




%d bloggers like this: