设置JPackage安装程序,使其不会覆盖较新版本中的配置文件

问题描述

我正在使用Java 14中的jpackage,这是我的build.gradle的Jpackage块:

runtime {

    options = ['--strip-debug','--compress','2','--no-header-files','--no-man-pages']
    modules = ['java.desktop','jdk.jfr','java.xml','jdk.unsupported','java.scripting','java.sql','java.logging','java.management','java.naming']

    launcher {
        noConsole = true
    }

    jpackage {
    
         installerName='CTG-Simulator'
         appVersion = '0.9.1'
         imageOptions += ['--icon','src/main/resources/images/simulator-icon.ico','--vendor','Trium']
   
        if(org.gradle.internal.os.OperatingSystem.current().windows) {
            installerType = 'msi'
            installerOptions = ['--win-per-user-install','--win-menu','--win-shortcut']
        }
        if(org.gradle.internal.os.OperatingSystem.current().linux) {
            installerType = 'deb'
            installerOptions = ['--linux-deb-maintainer [email protected]']
        }

    }
}

tasks.jpackageImage.doLast {
 println 'copying : config file and data folder ...'
    copy {
        from "src/main/resources"
        include "config.properties","data/*"
        into "build/jpackage/$project.name"
    }
}

tasks.jpackageImage.doLast 中,我将 config.properties data 目录添加到安装程序中,以便自动将其包括在内执行安装程序时在我的安装目录中。 有什么方法可以自定义安装程序,以使其不会覆盖较新版本的文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)