使用Gradle构建JavaFX应用程序 [英] Building a JavaFX application using Gradle

查看:116
本文介绍了使用Gradle构建JavaFX应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Gradle构建一个相对简单的JavaFX应用程序。
但是,我不知道该怎么做。

I'm trying to build a relatively simple JavaFX application using Gradle. However, I have no idea how to do it.

我对Gradle相对较新,对于简单(非javafx)项目我已成功使用插件 java 应用程序来构建和打包库和命令行应用程序。

I'm relatively new to Gradle, and for simple (non-javafx) project I've successfully used the plugins java and application to build and package libraries and command-line applications.

然而,我完全是在JavaFX方面遇到困难。我已阅读这篇文章,这建议使用 JavaFX 插件,但是我只能找到这个插件的源代码,但没有关于如何实际获取它的文档(在文章中他们只是从远程URL应用它,但在我的机器上失败,说我没有被授权......)

However, I'm completely stuck when it comes to JavaFX. I've read this article, which suggests using the JavaFX plugin, however I could only find the source code for this plugin, but no documentation on how to actually obtain it an use it (in the article they simply apply it from a remote URL, but that fails on my machine, says I'm not authorized...)

有关如何正确执行此操作的任何线索?

Any clues on how to do this properly?

推荐答案

这是GitHub上的Gradle JavaFX构建示例。请注意,根据Bintray ,该插件的最新版本是8.1.1,如果你想要最新的,请将插件URL中的'0.3.0'替换为'8.1.1'。

Here's an example Gradle JavaFX build on GitHub. Note that according to Bintray, the latest version of the plugin is 8.1.1, so replace the '0.3.0' in the plugin URL with '8.1.1' if you want the latest.

为了清楚起见,这是分发Gradle插件的一种非常不寻常的方式。大多数都更容易合并到构建中!

Just to be clear, this is a very unusual way to distribute a Gradle plugin. Most are much easier to incorporate in a build!

编辑:使用apply plugin https://github.com/FibreFoX/javafx-gradle-plugin

Edit: up-to-date fork that works using "apply plugin" https://github.com/FibreFoX/javafx-gradle-plugin

这篇关于使用Gradle构建JavaFX应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆