为桌面编译和构建 gluon 移动应用程序

compile and build gluon mobile app for desktop

我们有

desktopRuntime 'org.xerial:sqlite-jdbc:3.15.1'

在 gradle 文件中。 我构建项目,但我的 zip 文件在 lib 文件夹中没有这个文件。 我如何为桌面构建项目? 我的 ide 是 netbeans。 感恩

Try next steps:

1.

    dependencies {
      compile 'org.xerial:sqlite-jdbc:3.15.1'
      runtime 'org.xerial:sqlite-jdbc:3.15.1'
    }
  1. 转到 NetBeans 中的 "Files" 选项卡 IDE -> your_project -> build -> libs 并在此处将您的库添加为 sqlite-jdbc.jar

distZipjar gradle 任务的问题是它们没有包含桌面依赖项。

当部署到桌面时,您可以将临时 desktopRuntime 更改为 runtime,这样它们将被包含,正如 Ladislav Török 所建议的,但是您应该撤消更改以便不包含依赖项在移动部署中。

如果你想要一个有效的 zip,我们必须修改 distZip 任务,将桌面依赖项包含在 lib 文件夹中,并将它们包含在 class 路径中(所以它们也被添加到 bin 文件夹中的脚本中)。将此包含在您的 build.gradle 脚本中:

startScripts {
    classpath += configurations.desktopRuntime
}

distZip {
    into("$project.name/lib") {
        from configurations.desktopRuntime
    }
}

您也可以通过使用 shadowJar 来解决问题,前提是您包含桌面依赖项,以创建一个可执行的 fat jar,如 .