Created
May 19, 2017 20:31
-
-
Save slahn/3dbd252a179e601f53a42045bac016c7 to your computer and use it in GitHub Desktop.
SWT and JFace with Gradle and Kotlin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group 'example' | |
version '1.0-SNAPSHOT' | |
buildscript { | |
ext { | |
kotlin_version = '1.1.2-2' | |
osgi_platform = 'win32.win32.x86_64' | |
swt_version = '3.105.3' | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
} | |
} | |
apply plugin: 'java' | |
apply plugin: 'kotlin' | |
sourceCompatibility = 1.8 | |
repositories { | |
mavenCentral() | |
} | |
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") | |
} | |
} | |
} | |
dependencies { | |
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" | |
compile "org.eclipse.platform:org.eclipse.jface:3.12.2" | |
compile "org.eclipse.platform:org.eclipse.swt:$swt_version" | |
} |
There is a much simple alternative to get SWT working:
dependencies {
compile("org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:3.106.3) {
transitive = false
}
}
There is a much simple alternative to get SWT working:
dependencies { compile("org.eclipse.platform:org.eclipse.swt.win32.win32.x86_64:3.106.3) { transitive = false } }
for me it's not working while the first version working
This appears to be the only sane way to also add java 9 moodules, depending directly on specific platorm doesn't really work with java module system.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note to self, next time I'm looking for info on SWT and Maven:
https://objectteams.wordpress.com/2017/01/09/eclipse-neon-2-is-on-maven-central/