gradle - 我正在使用javafx-gradle-plugin,构建失败并显示 “Couldn'找不到Ant-JavaFX-library。如何指定JavaFX位置?

标签 gradle javafx java-10 openjfx javafx-gradle-plugin

我确实已经安装了openjfx(通过dnf),并且我相信它正在寻找的jar是在以下路径中安装的jar:

/usr/lib/jvm/openjfx/lib/ant-javafx.jar

显然,我想避免像这样对jar路径进行硬编码,但是我什至没有找到使用该路径的方法。这是gradle输出:
$ gradle tasks

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'testproj'.
> Couldn't find Ant-JavaFX-library, please make sure you've installed some JDK which includes JavaFX (e.g. OracleJDK or OpenJDK and OpenJFX), and JAVA_HOME is set properly.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 0s

gradle --version:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/travis/opt/gradle/4.9/lib/groovy-all-2.4.12.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

------------------------------------------------------------
Gradle 4.9
------------------------------------------------------------

Build time:   2018-07-16 08:14:03 UTC
Revision:     efcf8c1cf533b03c70f394f270f46a174c738efc

Kotlin DSL:   0.18.4
Kotlin:       1.2.41
Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          10.0.2 ("Oracle Corporation" 10.0.2+13)
OS:           Linux 4.18.9-200.fc28.x86_64 amd64

最佳答案

似乎没有一个好的答案,除了暂时坚持使用Java 8。

正如Some Guy在评论中提到的那样,某个新的Gradle插件可能会在某个时候取代该插件,但作者FibreFoX writes表示“请尽可能长时间使用该插件的当前状态”。这似乎意味着被卡在类路径中随JavaFX一起提供的Java的旧版本上了。

顺便说一句,考虑到新的java依赖DAG系统,维护插件的问题可能与打包有关。 8是使用旧类路径系统的最新版本。

我很高兴找到一个更好的答案。

关于gradle - 我正在使用javafx-gradle-plugin,构建失败并显示 “Couldn'找不到Ant-JavaFX-library。如何指定JavaFX位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52655216/

相关文章:

gradle - 使用持续集成在 Gradle 中发布快照与发布版本

java - 是否可以将滚动条更改为 ListView 的左侧?

debian - Java 10 : "No documentation found" for System. out.println(...)

java - 如何升级 javax.naming.* 和 javax.xml.* 导入以与 java 10 兼容

gradle - gradle项目子模块中的端到端测试

android-studio - 无法在Android Studio中单击 'Install Respository…'

java - 为什么禁用的 JavaFX TextArea 的颜色与 TextField 不同

java - WeekFields 在 JVM 8 和 JVM 10 上的不同行为

android - Gradle 构建比 Eclipse ADT 更严格(例如,多次找到项目 _)

javafx - 如何在 OpenJDK7 中使用 JavaFX