Skip to content

Commit

Permalink
build.gradle: add javafx runtime dependency for other platforms
Browse files Browse the repository at this point in the history
We have added the platform specific javafx runtime dependency, so the
addressbook is able to run locally.

However, the jar file generated on one OS cannot run on other OS. The
reason is that, java SE cannot initialize the graph render correctly
without corresponding javafx dependency for that other OS.

Let's add the javafx runtime dependency for all platforms (MacOS,
Window, Linux) so the jar file generated on one OS is able to run in
other OS [1].

[1]https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing/52654791#52654791
  • Loading branch information
fzdy1914 committed Mar 31, 2019
1 parent d1c201b commit bed663e
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,8 @@
// For more details take a look at the Java Quickstart chapter in the Gradle
// user guide available at http://gradle.org/docs/5.2.1/userguide/tutorial_java_projects.html

import org.apache.commons.lang3.SystemUtils
import org.gradle.api.tasks.testing.logging.TestLogEvent

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
}
}

plugins {
id 'java'
id 'jacoco'
Expand Down Expand Up @@ -51,26 +41,29 @@ test {
useJUnitPlatform()
}

String platform
if (SystemUtils.IS_OS_WINDOWS) {
platform = 'win'
} else if (SystemUtils.IS_OS_LINUX) {
platform = 'linux'
} else if (SystemUtils.IS_OS_MAC) {
platform = 'mac'
}

dependencies {
String testFxVersion = '4.0.15-alpha'
String jUnitVersion = '5.1.0'
String javafxVersion = '11'

implementation group: 'org.openjfx', name: 'javafx-base', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-controls', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-media', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: platform
implementation group: 'org.openjfx', name: 'javafx-base', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javafxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javafxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javafxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-media', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-media', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-media', version: javafxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: 'linux'

implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4'
Expand Down

0 comments on commit bed663e

Please sign in to comment.