Collaborative Editing

21. June, 2008

Mustafa K. Isik has a video on vimeo demonstrating collaborative editing of a Java class in Eclipse. I’m not sure where this leads and my experience winces at the idea but it would sure help if the superman of your team could attach to your editing session, see the code you’re working on and help you fix it (instead of having to get up and coming over).


P2: A Lot of Pain, No Gain

19. May, 2008

If you’re an Eclipse user, you probably heard of p2. There seems to be two groups of people: Those who adore it and those who hate it. I’m in the latter group. Here are my reasons:

  1. Where do I get the installer? There is no explanation on the Getting Started page. Try this link.
  2. The 3.4M7 release doesn’t even start on Windows because it’s broken.
  3. The installer fails if the directory to install to doesn’t exist, yet. Hey, it will be fixed after the 3.4 release!
  4. When I tried a shared install, it crashed. That’s supposed to be fixed but I didn’t dare to try again.
  5. Not enough? Well, if any of the downloads times out, you have to delete the install directory and download everything again (Bug 231826).

So I’ve downloaded four (4) versions of P2, tried them and all of them failed before I could even start Eclipse.

Banana-ware: Harvested before ripe, delivered green and ripes on the customer’s computer.


N&N in Eclipse 3.4M4: StringBuffer “Optimization”

18. December, 2007

Another one for the futile/harmful optimization awards: The New & Noteworthy page for Eclipse 3.4M4 says:

The new ‘Convert to StringBuffer’ quick assist (Ctrl+1) transforms string concatenations into more efficient, albeit less compact, code using an explicit StringBuffer:

Hello? Since when is using StringBuffer more efficient than using String concatenation? Answer: It was upto Java 1.3 (or maybe 1.2; I’m too lazy to look it up right now).

With Java 1.4, the compiler used StringBuffer as well, so this optimization doesn’t buy anything but makes the code harder to read.

Worse, with Java 1.5, the compiler generates more optimal code by using StringBuilder instead of StringBuffer. The builder is not synchronized; since string concatenation doesn’t suffer from threading issues, this is safe and faster!

And the morale: If you optimize something, make sure you don’t rely on some myth about X being faster than Y.

PS: Of course, there is already a bug tracking this.


Downloading Sources for Maven2 Projects

25. September, 2007

If you ever needed to download the source artifacts for a Maven2 project, there were several options: If you use the Eclipse plugin (either the Eclipse plugin for Maven2 or the Maven Plugin for Eclipse, also called “Maven Integration for Eclipse”), you can use the option -DdownloadSources=true from the command line or enable the “Download sources” preferences option.

Both have some drawbacks. When you use the Maven Plugin in the Eclipse IDE, it will try to download the sources all the time which blocks the workflow. If you just want to do it once, you have to enable and disable the option all the time plus you have to force the plugin to start the download (with 0.12, you can add and delete a space in the POM and save it). But it will only download the sources for a single project.

If you use the command line version to download the sources, it will overwrite the .project file and modify your preferences, etc. Also not something you will want.

There are two solutions. One would be the “-Declipse.skip=true” option of the command line plugin. Unfortunately, this option doesn’t work. It will prevent the plugin from doing anything, not only from writing the project files.

So if you have a master POM which includes all other projects as modules and all your projects are checked into CVS, you can run:

mvn eclipse:eclipse -DdownloadSources=true

to download all sources and then restore the modified files from CVS. I’ve opened a bug which contains a patch for the skip option. After applying it, -Declipse.skip=true will just skip writing the new project files but still download the source artifacts.