Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

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 the 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 5, 2019
1 parent b383d8f commit 41b0bb5
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 @@ -44,12 +44,20 @@ test {
}

def platform
def firstOtherPlatform
def 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 @@ -63,6 +71,11 @@ dependencies {
compile "org.openjfx:javafx-media:11:${platform}"
compile "org.openjfx:javafx-web:11:${platform}"

compile "org.openjfx:javafx-graphics:11:${firstOtherPlatform}"
compile "org.openjfx:javafx-graphics:11:${secondOtherPlatform}"
compile "org.openjfx:javafx-web:11:${firstOtherPlatform}"
compile "org.openjfx:javafx-web:11:${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 41b0bb5

Please sign in to comment.