在安装更新期间保留文件夹及其内容

Preserving a folder and its content during an installation update

我有一个解决方案,但不知道如何在 install4j 中本地完成。

我有一个包含工件存储库的文件夹(类似于 Maven 的 .m2 存储库文件夹模式),其中文件名是在 Maven 编译期间唯一生成的(时间戳)。

例如./install-dir/artifacts/app-core/jar/1.2-t20160419183129/app-core-1.2-t20160419183129.jar

在 运行 选中 "Update existing installation" 的安装程序后,install4j 将附加这些文件并保留该工件的带时间戳的旧版本。我知道这不是错误并且正在按预期工作。所以最终结果将如下所示:

./install-dir/artifacts/app-core/jar/1.2-t20160415154633/app-core-1.2-t20160415154633.jar
./install-dir/artifacts/app-core/jar/1.2-t20160419183129/app-core-1.2-t20160419183129.jar

这些文件中除了编译期间生成的时间戳外没有任何变化。那么我可以在 install4j 中使用任何方法来验证上面提到的组件是否比安装程序对应的组件更新。它必须忽略时间戳,只考虑版本号和 md5 校验和。

现在,我正在完全删除 artifacts 文件夹并将其替换为安装程序版本。但是,这是一种我希望迁移的激进方法。

Right now, I am completely removing the artifacts folder and replacing it with the installers version. However, that is an aggressive approach that I hope to migrate away from.

我会坚持这个策略。如果 JRE 文件在新版本中被删除了怎么办?如果您只匹配没有时间戳的更新,旧的 JAR 文件将保留在安装中和 class 路径上。

否则,install4j(自 6.1 起)中没有允许您以这种方式执行更新的功能。