Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using SWT with gradle (not in eclipse IDE)
Using SWT with gradle (not in eclipse IDE) [message #1810902] Wed, 21 August 2019 13:49 Go to next message
Bartosz Skrzypczak is currently offline Bartosz SkrzypczakFriend
Messages: 2
Registered: August 2019
Junior Member
For now I'm trying to determine if using SWT is going to be even a good idea for my project, but I want to do some tests with SWT first (and that includes getting it all working). And I can't get it working. So far I can get it working in my IDE, but I'm unable to build a jar using gradle.

After a lot fo searching, I found a relatively recent version of SWT available in maven repository would be included like this into gradle:

compile("org.eclipse.platform:org.eclipse.swt.gtk.linux.x86_64:3.111.0")

And that's enough to keep the IDE happy, but when I try to do a gradle build, it can't resolve some dependencies:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtime'.
> Could not find any matches for org.eclipse.platform:org.eclipse.swt.${osgi.platform}:[3.111.0,3.111.0] as no versions of org.eclipse.platform:org.eclipse.swt.${osgi.platform} are available.
Searched in the following locations:
(URLs to all the maven repositories, including maven central and jcenter go here, but this forum won't let me include URLs yet)
Required by:
project : > org.eclipse.platform:org.eclipse.swt.gtk.linux.x86_64:3.111.0 > org.eclipse.platform:org.eclipse.swt:3.111.0

Re: Using SWT with gradle (not in eclipse IDE) [message #1826478 is a reply to message #1810902] Sat, 25 April 2020 16:03 Go to previous messageGo to next message
Bartosz Skrzypczak is currently offline Bartosz SkrzypczakFriend
Messages: 2
Registered: August 2019
Junior Member
After a long search I finally found this:
https://gist.github.com/slahn/3dbd252a179e601f53a42045bac016c7

With the important parts being:

buildscript {
    ext {
        kotlin_version = '1.1.2-2'
        osgi_platform = 'win32.win32.x86_64'
        swt_version = '3.105.3'
    }
//...
}


and:

configurations.all {
    resolutionStrategy {
        dependencySubstitution {
            // The maven property ${osgi.platform} is not handled by Gradle
            // so we replace the dependency, using the osgi platform from the project settings
            substitute module('org.eclipse.platform:org.eclipse.swt.${osgi.platform}') with module("org.eclipse.platform:org.eclipse.swt.$osgi_platform:$swt_version")
        }
    }
}
Re: Using SWT with gradle (not in eclipse IDE) [message #1826549 is a reply to message #1826478] Mon, 27 April 2020 03:03 Go to previous message
Andy Maleh is currently offline Andy MalehFriend
Messages: 75
Registered: March 2020
Location: Montreal, Quebec, Canada
Member
Since you're new to SWT, check out this SWT DSL project. It may make your life much easier: https://github.com/AndyObtiva/Glimmer

EclipseCon / EclipseWorld / Agile Conference Speaker
Open-Source Software Author of Glimmer DSL for SWT
Previous Topic:SWT for Pocket PC
Next Topic:Browser in Private mode
Goto Forum:
  


Current Time: Thu Apr 25 23:26:16 GMT 2024

Powered by FUDForum. Page generated in 0.03668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top