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].

The order of dependency is important because it effects the way Gradle
group dependency tree.

[1]https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing/52654791#52654791
  • Loading branch information
fzdy1914 committed Mar 21, 2019
1 parent 3d9a8b3 commit 3e4620a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@ test {
}

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

dependencies {
Expand All @@ -73,6 +81,11 @@ dependencies {
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-graphics', version: javafxVersion, classifier: firstOtherPlatform
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javafxVersion, classifier: secondOtherPlatform
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: firstOtherPlatform
implementation group: 'org.openjfx', name: 'javafx-web', version: javafxVersion, classifier: secondOtherPlatform

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 3e4620a

Please sign in to comment.