maven project: SWT 3.5 dependency: any official public repo?
Asked Answered
M

5

18

Well, in short, I may need to grab new SWT version instead of 3.3 we're using for now. The project now has only this dependency and builds fine:

<dependency>
  <groupId>org.eclipse.swt.win32.win32</groupId>
  <artifactId>x86</artifactId>
  <version>3.3.0-v3346</version>
</dependency>

AFAICGoogle, there is no more recent version in the public maven repo: http://repo1.maven.org/maven2/org/eclipse/swt/

So:

  1. Is there some public maven repo with recent builds?
  2. If not, where do you get the jars you install locally and/or in your corporate Nexus?
  3. Any groupId/artifactId suggestions/conventions you know of?

TIA

PS: I am mostly a noob as to Eclipse products site layout and usually get lost in Google search results and/or the Eclipse site itself... so while the answer may be obvious for you it would likely not be so for me, even retrospectively.

Marrin answered 23/2, 2011 at 19:53 Comment(1)
See my answer below for a maven repository holding the latest (3.7.2) SWT artifacts.Potted
H
16

Update: The repo was taken down and replaced by repo.eclipse.org which does not hold SWT artifacts.

You can use a Nexus repository hosted at eclipse (this repository is in 'testing' status)

http://maven.eclipse.org/nexus/content/repositories/testing/org/eclipse/swt/

There is a bug open on this with further info: https://bugs.eclipse.org/bugs/show_bug.cgi?id=199302

Hissing answered 21/10, 2011 at 18:24 Comment(2)
See my answer below for an updated maven repository hosting the latest (SWT 3.8) artifactsPotted
This link is not responding, but the one below to googlecode works!Lapoint
P
42

I have created a maven repo for windows, Linux & osx artifacts at github:

https://github.com/maven-eclipse/swt-repo

To use it just put the following in your pom.xml:

<repositories>
    <repository>
        <id>swt-repo</id>
        <url>https://raw.githubusercontent.com/maven-eclipse/swt-repo/master/</url>
    </repository>
</repositories>

Then you can just reference the SWT dependency relevant to your platform. For example:

    <dependency>
        <groupId>org.eclipse.swt</groupId>
        <artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
        <version>4.4</version>
    </dependency>

For other platforms, just replace artifactId with the appropriate value:

  • org.eclipse.swt.win32.win32.x86
  • org.eclipse.swt.win32.win32.x86_64
  • org.eclipse.swt.gtk.linux.x86
  • org.eclipse.swt.gtk.linux.x86_64
  • org.eclipse.swt.cocoa.macosx
  • org.eclipse.swt.cocoa.macosx.x86_64

In addition, artifacts for SWT 4.3.2, 4.3.1, 4.3.0, 4.2.2, 4.2.1, 3.8, 3.7.2 & 3.5.1 are also available from this repository.

We use a selenium-based approach to automatically deploy the artifacts of new SWT versions as they are released. The source code for the automation is open and available on github:

https://github.com/hennr/swt-release-fetcher

Happy coding!

Potted answered 2/4, 2012 at 23:29 Comment(1)
Both swt-repo and swt-release-fetcher are no longer maintained since Oct. 2015. See these two SO answers to grab SWT related artifacts: https://mcmap.net/q/529608/-how-do-you-build-an-swt-application-with-maven and https://mcmap.net/q/538982/-maven-project-swt-3-5-dependency-any-official-public-repo.Cyler
H
16

Update: The repo was taken down and replaced by repo.eclipse.org which does not hold SWT artifacts.

You can use a Nexus repository hosted at eclipse (this repository is in 'testing' status)

http://maven.eclipse.org/nexus/content/repositories/testing/org/eclipse/swt/

There is a bug open on this with further info: https://bugs.eclipse.org/bugs/show_bug.cgi?id=199302

Hissing answered 21/10, 2011 at 18:24 Comment(2)
See my answer below for an updated maven repository hosting the latest (SWT 3.8) artifactsPotted
This link is not responding, but the one below to googlecode works!Lapoint
M
11

Grab here the version you need. SWT is still not bundled platform-neutrally, so you have to pay attention to the platform to use. I'd grabbed windows version, with postfix of 3.6.1-win32-win32-x86. I've used that as a versionId, leaving the platform out of group/artifact fields. This might be not totally correct for maven gurus but fits for me quite well (at least for now). Also I am using the debug-version of the jar, which is okay for development.

So here we go.

Unpack the archive and then issue this (in the root folder of your archive):

mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.6.1-win32-win32-x86 -Dfile=swt-debug.jar -Dpackaging=jar -DlocalRepositoryPath=../path/to/your/local/project/repo

and then this, to install sources as well:

mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.6.1-win32-win32-x86 -Dfile=src.zip -Dpackaging=jar -Dclassifier=sources -DlocalRepositoryPath=../path/to/your/local/project/repo

Add reference to a local repo to your pom.xml,

<repositories>
    <repository>
        <id>local</id>
        <name>Project Local Repository</name>
        <layout>default</layout>
        <url>file://${project.baseDir}/path/to/your/local/project/repo/</url>
    </repository>
</repositories>

and then add a dependency itself:

<dependency>
    <groupId>org.eclipse</groupId>
    <artifactId>swt</artifactId>
    <version>3.6.1-win32-win32-x86</version>
</dependency>

Hope this helps someone, and I get some karma for bounties on other, harder questions of mine... ;)

Marrin answered 3/3, 2011 at 19:11 Comment(1)
By the way, if you are installing it on linux the command should be mvn install:install-file -DgroupId=org.eclipse -DartifactId=swt -Dversion=3.7-gtk-linux-amd64-x86 -Dpackaging=jar -Dfile=swt-debug.jarNewcastle
A
4

have a look at the maven-eclipse-plugin. Assuming you have a local eclipse installation at /opt/eclipse, do the following:

mvn eclipse:to-maven -DeclipseDir=/opt/eclipse/ -DstripQualifier=true

This will generate poms for all eclipse plugins and upload them to your local repo. It's also possible to load the generated poms and jars to a remote repo using the plugin option "deployTo".

See also:
maven-eclipse-plugin

After that you can use the artifacts from the repository.

Hope the information is helpfull.

-Martin

Analog answered 18/3, 2011 at 16:40 Comment(1)
Not sure this will get me going with SWT jars. Are you serious about installing eclipse just to mavenize one library jar for a specific platform? I think the whole library/update approach, which eclipse platform uses, goes to some weird direction if you're serious...Marrin
T
4

As of Neon.2 (v 4.6.2) many Eclipse bundles, including SWT, are available on Maven Central:

https://repo1.maven.org/maven2/org/eclipse/platform/

Note that, in contrast to earlier published SWT artifacts, the group id was changed to org.eclipse.platform. To include SWT for Windows, for example, add this to your pom:

<dependency>
    <groupId>org.eclipse.platform</groupId>
    <artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
    <version>${swt-version}</version>  <!-- currently 3.105.2 -->
</dependency>

From now on, all Eclipse platform releases (currently published every year around June) will be available as maven artifacts. See here to find the most recent version number: https://search.maven.org/#search%7Cga%7C1%7Corg.eclipse.platform%20swt

See here for an announcement with further details: https://objectteams.wordpress.com/2017/01/09/eclipse-neon-2-is-on-maven-central/

Tableau answered 11/1, 2017 at 8:53 Comment(6)
If I try to use this location in a gradle buid file, I get "Could not find any matches for org.eclipse.platform:org.eclipse.swt.gtk.linux.aarch64:[3.105.2,3.105.2]". I guess it's related to bug 491951...? Do you happen to know how to exclude this platform in gradle? I am trying to build a library that depends on SWT, so theoretically I should need only the SWT "declarations", no actual platform implementation.... Is there any "clean" gradle way for this case?Somnolent
I am afraid, I don't know of a clean way to work around this in Gradle. Unfortunately, SWT does not provide separate artifacts for API and implementation - and guessing from how the source code is organized this isn't easy to achieve either. Have you tried using the repository mentioned in in comment #35 as a workaround?Nikkinikkie
#35 points to an eclipse update site... Are you aware of any way to point gradle to this?Somnolent
Ups, my bad.Your best bet may be to attempt to convert the p2 repository into Maven repository.Nikkinikkie
The latest version served by this repository seems to be ancient. If I try to use it, I cannot compile because certain classes are missing methods. Specifically, the Color class does not seem to have a getAlpha() method. Is my understanding correct that the versions served by this repository are useless today, or am I doing something wrong?Katherinakatherine
I couldn't find a recent version either. To clarify what their current policy for releasing Maven artefacts is you may want to ask on the eclipse platform mailing list: accounts.eclipse.org/mailing-list/platform-dev .Nikkinikkie

© 2022 - 2024 — McMap. All rights reserved.