Using SWT and JFace with Maven in non-OSGi projects

There is no problem in using SWT and JFace in Eclipse applications.
These libraries were designed for it. Eclipse building solutions handle them well (p2, Tycho…).

SWT and JFace can also be used outside Eclipse.
However, they are not usable as libraries with Maven. Only as bundles with Tycho. This is because Eclipse releases are not hosted on Maven repositories but on p2 repositories. The Maven plugin called Tycho allows Maven, among other things, to rely on p2 repositories. But it is intended to build OSGi applications.

Hopefully, there is now a regular Maven repository that hosts SWT and JFace bundles as libraries.
Thus, they can be used with Maven, in non-Osgi projects. This repository is available at this address:

To use these libraries in a non-Osgi project, add the repository to your POM.


If you only want to use SWT, add the SWT library that fits your operating system.
As an example, for Windows x64.

   <!-- SWT -->

If in addition you want to use JFace and Eclipse extensions for JFace (ListDialog, ListeSelectionDialog…), add the following dependency. This will add JFace by transitivity.

   <!-- JFace + Eclipse's JFace extensions -->

If you need JFace but not its Eclipse extensions, add instead…

   <!-- JFace dependencies -->

Other versions of SWT and JFace should be added to the repository.
Another solution could be based on Tycho. But so far, I have not found any solution. I started a thread about this on the Tycho-user mailing list.

Anyway, the solution described above will fit all the Maven versions.
A Tycho-based solution would only work with Maven3 (but would avoid duplicating the libraries).

9 thoughts on “Using SWT and JFace with Maven in non-OSGi projects

      1. Hi,

        You are right. In fact, swt-repo was created because there is no official support of Maven with SWT (except through Tycho when developping for Eclipse). You can find more information and all the related history in this bug at

  1. I want just to add that if you need to setup dependecies in maven for different OS you can use “profiles” like this:







    Thanks for this post!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s