Writing Eclipse SWT apps using Maven

I’ve been trying to get my feet wet writing code for the Eclipse platform. I figured a good first step is to become familiar with Eclipse SWT—the Standard Widget Toolkit, and work my way up from there.

Since I use Maven, I had to struggle a bit finding out how to configure my Maven project properly so that it’ll build an SWT app that’ll run both under Eclipse and from the terminal.

A little Googling brought me to Brice Lambi’s post on Maven SWT builds, but that was a little outdated.

In particular (and only after careful reading), the guide to Deploying SWT apps on Mac OS X says that the -Djava.library.path=.. option is needed for Eclipse 3.2.2 and earlier. Apparently, starting with 3.4 all you need is your OS-specific JAR (see here).

Anyway, after much fiddling about, I was able to get it all working like so: Continue reading