要解決您的問題,您需要JavaFX-Gradle-plugin,它是一個插件,可以在Gradle項目上啓用JavaFX支持。
這是插件的鏈接:https://github.com/FibreFoX/javafx-gradle-plugin,在那裏你可以找到所有相關信息和例子...
所有你需要的是開始一個新的搖籃的項目,然後添加到文件的build.gradle驗證碼:
buildscript {
dependencies {
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
}
repositories {
mavenLocal()
mavenCentral()
}
}
apply plugin: 'java'
repositories {
mavenLocal()
mavenCentral()
}
dependencies{
// put here your project dependencies
}
apply plugin: 'javafx-gradle-plugin'
// these values are the examples and defaults
// you won't need them all
// configure javafx-gradle-plugin
jfx {
// minimal requirement for jfxJar-task
mainClass = 'YOUR.MAIN.CLASS'
// minimal requirement for jfxNative-task
vendor = 'YOUR NAME OR COMPANY'
// some optional task
jfxAppOutputDir = 'build'
jfxMainAppJarName = 'YOUR APPLICATION NAME.jar'
manifestAttributes = [
"Specification-Version": 1.0,
"Implementation-Version": 1,
"Built-By": "YOUR NAME OR COMPANY",
]
// for a full list of available settings, look the class "JavaFXGradlePluginExtension" on plugin project
}
這是我發現的使用JavaFX和Gradle的唯一插件。 我正在用Eclipse處理項目中的問題,並且幾天前我已經解決了它。
希望這有助於,
BoGnY