如果您在 IDE 中使用 Gluon 插件,并选择 Gluon Mobile 模板,您应该获得所有插件、依赖项和底层工具的最新版本。
当您创建项目时,系统会进行在线检查以验证哪些是最新版本,因此您的新项目是最新的。尽管有可能发生任何这些更改后后端没有立即更新。
使用单一视图模板,您将获得此 build.gradle 文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.5'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonhq.testsingle.GluonTestSingle'
dependencies {
compile 'com.gluonhq:charm:4.3.2'
}
jfxmobile {
downConfig {
version = '3.2.4'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
这是使应用在桌面、Android 和 iOS 上运行的脚本所需的最低内容。
至于jfxmobile插件,如您所说,最新版本(截至目前1.3.5)可以验证here。
默认情况下,它包含最新版本的 JavaFXPorts:javafxportsVersion = '8.60.9',因此您无需在构建中包含它。但是您可能希望在某些情况下使用它,即当您使用快照、每日或每月构建时(客户可以访问它们),以防添加了新的更改并且您不想等到下一个公开版本.最新版本可以在here找到。
此插件与 Gluon Mobile 无关。前者是安装 JavaFXPorts 依赖项(如 dalvik-sdk、jfxdvk.jar 和 ios-sdk)和所需工具(gradle 任务……)的插件,后者是包含视图、控件、样式的库。 .. 以及其他依赖项,这些依赖项位于 JavaFXPorts 之上,用于从单个 Java 代码库创建高性能、美观和云连接的移动应用程序,适用于 iOS 和 Android。
这就是您首先需要插件的原因,您可以稍后添加 Gluon Mobile 依赖项。
截至目前,最新版本为 4.3.5,您可以查看here。在线工具仍显示 4.3.2,但此时差异很小。
Gluon Mobile(Charm 依赖项)也使用其他依赖项。运行./gradlew dependencies,你会看到这样一棵树:
runtime - Runtime dependencies for source set 'main'.
+--- com.gluonhq:charm:4.3.5
| +--- com.gluonhq:connect:1.4.3
| | \--- org.glassfish:javax.json:1.0.4
| +--- com.gluonhq:charm-cloudlink-client:4.3.5
| | +--- com.gluonhq:connect:1.4.3 (*)
| | +--- com.gluonhq:charm-down-plugin-storage:3.2.4
| | | \--- com.gluonhq:charm-down-core:3.2.4
| | +--- com.gluonhq:charm-down-plugin-device:3.2.4
| | | \--- com.gluonhq:charm-down-core:3.2.4
| | \--- com.gluonhq:charm-down-plugin-push-notifications:3.2.4
| | +--- com.gluonhq:charm-down-core:3.2.4
| | \--- com.gluonhq:charm-down-plugin-runtime-args:3.2.4
| | \--- com.gluonhq:charm-down-core:3.2.4
| +--- com.gluonhq:charm-glisten-connect-view:4.3.5
| | +--- com.gluonhq:charm-cloudlink-client:4.3.5 (*)
| | \--- com.gluonhq:charm-glisten:4.3.5
| | +--- com.gluonhq:charm-down-plugin-display:3.2.4
| | | \--- com.gluonhq:charm-down-core:3.2.4
| | +--- com.gluonhq:charm-down-plugin-lifecycle:3.2.4
| | | \--- com.gluonhq:charm-down-core:3.2.4
| | +--- com.gluonhq:charm-down-plugin-statusbar:3.2.4
| | | \--- com.gluonhq:charm-down-core:3.2.4
| | \--- com.gluonhq:charm-down-plugin-storage:3.2.4 (*)
| \--- com.gluonhq:charm-glisten:4.3.5 (*)
+--- com.gluonhq:charm-down-plugin-display:3.2.4 (*)
+--- com.gluonhq:charm-down-plugin-lifecycle:3.2.4 (*)
+--- com.gluonhq:charm-down-plugin-statusbar:3.2.4 (*)
\--- com.gluonhq:charm-down-plugin-storage:3.2.4 (*)
基本上它包括对 Charm Glisten、Gluon Connect、Charm Cloudlink Client、Charm Glisten Connect View 和不同 Charm Down 插件的依赖。
Charm Down,您可以找到最新版本here。其实最近3.3.0已经发布了。理论上,您也不需要在此处指定版本,但建议您在创建项目时跟踪您使用的版本。
Gluon Mobile 中不包含 Charm Down,因此您必须在项目中使用downConfig,以至少显式添加 Gluon Mobile 使用的所需插件(默认添加的四个:'display'、'lifecycle' ,“状态栏”,“存储”)。但如果需要,您可以添加更多插件(选择右键单击根项目并单击 Gluon Mobile Settings)。
编辑
Gluon Mobile 包含来自 Down 的四个服务作为依赖项(像 charm-down-plugin-storage 这样的 jar仅 带有 Service 定义),但只有在包含平台时它才会在您的项目中解析通过downConfig 实现(如charm-down-plugin-storage-desktop、charm-down-plugin-storage-android 和charm-down-plugin-storage-ios)。
如上所述,版本应该是您创建项目时的最新版本,但如果您发现更新的版本,您可以仔细检查并手动更新。
至于 Gluon Mobile Settings 菜单,这是一张如何在 NetBeans 上获取它的图片。只需右键单击项目根目录: