我有一个使用 oracle JDK 开发的 springboot 应用程序,它使用 javafx.util.pair 类。当构建的 jar 在具有 OpenJDK 的系统上运行时,它找不到此类。我怎样才能用我的 jar 打包这个依赖项?我正在使用渐变。这是我的 build.gradle 文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE")
}
}
description = "CF Service Broker using Java / Spring"
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'cf-tile'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-devtools")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('com.jayway.jsonpath:json-path')
testCompile group: 'junit', name: 'junit', version: '4.12'
}
最佳答案
我不相信你可以通过 gradle 导入 javafx utils,但你可以,对于不包含它的 OpenJDK 版本的平台,使用 openjfx。
例如,您可以使用以下方式在 ubuntu 中安装它:
sudo apt-get install openjfx
关于java - 在 gradle 中包含 javafx.util.Pair 作为依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48939345/