Tuesday, April 03, 2012

Broken by design, I guess

Sometimes I have to jump through so many hoops just get something working, I just have to write it down. Especially because I just *know* that somehow, somewhere, some*when*, I'm going to have to do it again. Especially in software that I assume should work out of the box, seeing as it's so popular. Or maybe I just don't do things the "normal" way and it's really just me. *shrug*

Working on Mono for Android, sometimes I can't escape looking at java. It was only today that I've actually had to build things with something other than ant, so I had to install Eclipse. I really favour command line tools over running an IDE, though, so I went on a hunt to find out how to build Eclipse projects from the command line.

I found a few topics called Headless Building and Batch Compiler, which looked promising. Of course, the executable required for the first is completely missing in my installation (Eclipse Classic 3.7.2), so I tried the ant variant next (some StackOverflow posts pointed to that being a decent solution for this). It immediately crashed with

[apt] Warning: NLS missing message: JdtApt_noWorkspace in: org.eclipse.jdt.apt.core.build.messages
[apt] Warning: NLS missing message: JdtApt_noEclipse in: org.eclipse.jdt.apt.core.build.messages
[apt] Warning: NLS missing message: JdtApt_noStartupJar in: org.eclipse.jdt.apt.core.build.messages

The last one was also an error and the build failed. A quick search on JdtApt_noStartupJar revealed this. Note line 54:

startupJar = new File(file, "startup.jar"); //$NON-NLS-1$

Soooo... startup.jar? There's nothing like that in my eclipse folder. Another quick search reveals this short but enlightening post, which basically says that startup.jar hasn't existed in Eclipse since at least 2009 (*looks at the calendar and sighs*) and that the solution is to replace all references to that file to "$ECLIPSE_HOME/plugins/org.eclipse.equinox.launcher_version.jar".

Since I can't just go and change the paths on that apt plugin thingy, I instead went and symlinked the new file to a startup.jar in the Eclipse directory. Et voilá, things work.

3 comments:

shamaz said...

So you found a bug in Eclipse ?
cool...
What's actually broken by design ? Is it really related to java ?
Most people prefer using maven+javac. Headless usage of eclipse is more like... a toy.

andreia|gaita said...

@shamaz

Yes, it's an eclipse bug. I believe I was clear about why I wrote this post, it's right there on the first line. I couldn't care less about maven, playing best build system wasn't the point, getting an eclipse project building on the command line was.

If a plugin shipped in eclipse by default references files that haven't existed for 3 years, I call that broken by design. Not to mention, yuck, hardcoded filenames?

And who said this had anything to do with Java?

AddCodPer said...

Well... I Found your cat so cute <3 :D