如何使用 jlink 图像捆绑额外的文件
How to bundle extra files with jlink image
我正在使用 Gradle 和 Badass JLink Plugin 来分发我的软件。不幸的是,我不知道如何在图像中包含某些文件(例如 README.md、一些测试输入等)。我认为它需要在 build.gradle
中进行一些工作,但到目前为止我还没有弄明白。
按照 these instructions 使用 application
插件的 distZip
功能很容易做到这一点,但我更喜欢使用 jlink 图像进行分发,这样用户就不需要 Java已安装。
这甚至可以用 jlink 来做吗?如果没有,这似乎是一个巨大的缺点。
感谢@VGR 的有用评论,我能够在 build.gradle
中找到解决问题的方法:
def JLINK_DIR = "$buildDir/myApp"
tasks.jlink.doLast {
copy {
from("/") {
include "README.md", "LICENSE"
}
into JLINK_DIR + "/docs"
}
copy {
includeEmptyDirs = false
from("/path/to/sample/input") {
include "sample_input_1/*"
include "sample_input_2/*"
exclude "output"
}
into JLINK_DIR + "/sample_input"
}
}
Gradle Docs on copy and the Badass JLink Plugin examples 特别有帮助。
谢谢,这真的很有帮助。对我来说,我试图添加到安装程序。我必须执行以下操作:
def JLINK_DIR = "$buildDir/jpackage/MyApp"
tasks.jpackage.doFirst {
copy {
from("/config") {
include "config.properties"
}
into JLINK_DIR + "/config"
}
}
我正在使用 Gradle 和 Badass JLink Plugin 来分发我的软件。不幸的是,我不知道如何在图像中包含某些文件(例如 README.md、一些测试输入等)。我认为它需要在 build.gradle
中进行一些工作,但到目前为止我还没有弄明白。
按照 these instructions 使用 application
插件的 distZip
功能很容易做到这一点,但我更喜欢使用 jlink 图像进行分发,这样用户就不需要 Java已安装。
这甚至可以用 jlink 来做吗?如果没有,这似乎是一个巨大的缺点。
感谢@VGR 的有用评论,我能够在 build.gradle
中找到解决问题的方法:
def JLINK_DIR = "$buildDir/myApp"
tasks.jlink.doLast {
copy {
from("/") {
include "README.md", "LICENSE"
}
into JLINK_DIR + "/docs"
}
copy {
includeEmptyDirs = false
from("/path/to/sample/input") {
include "sample_input_1/*"
include "sample_input_2/*"
exclude "output"
}
into JLINK_DIR + "/sample_input"
}
}
Gradle Docs on copy and the Badass JLink Plugin examples 特别有帮助。
谢谢,这真的很有帮助。对我来说,我试图添加到安装程序。我必须执行以下操作:
def JLINK_DIR = "$buildDir/jpackage/MyApp"
tasks.jpackage.doFirst {
copy {
from("/config") {
include "config.properties"
}
into JLINK_DIR + "/config"
}
}