根据我的要求,我应该使用 NSIS 还是 jprofiler/install4j

发布于 2024-12-06 07:09:35 字数 582 浏览 0 评论 0原文

我们有一个 Web 应用程序,需要让客户更容易部署它。 全新安装的当前工作流程:

  • 确保计算机上有 JRE(32 或 64 位)
  • 安装 Tomcat(32 或 64 位)
  • 在 Oracle 或 SQL Server 中创建数据库(我们为此提供 SQL 脚本)
  • 将一些值写入我们的设置表,如主机名。 (可以让用户验证这些,但不希望用户必须点击它们。
  • 创建一个连接属性文件(我们提供一个迷你 JAR 应用程序来帮助完成此操作),该文件将位于 Tomcat 下。
  • 我们有两个实际的 WAR 文件这些可以拆分到两台机器上,但现在,我们假设它们都被转储到 Tomcat 下,
  • 以便它部署 WAR

。这对于我们的用户来说是一个乏味的过程。 我想将它封装到一个安装程序中,并且一直在考虑在 NSIS 中执行此操作,NSIS 似乎有一个很大的社区,但后来也偶然发现了 install4j,尽管它似乎不太为人所知,但它更特定于基于 java 的应用程序。

只是想从更有经验的用户那里获得一些关于平台最佳选择的反馈。

我不想半途而废,然后意识到我选择了错误的安装程序平台。

We have a web application that we need to make easier to deploy for our clients.
The current workflow for a fresh install:

  • Ensure there is a JRE on machine (32 or 64bit)
  • Install Tomcat (32 or 64bit)
  • Create a database in Oracle or SQL Server (we provide SQL scripts for this)
  • Write some values into our settings table, like hostname. (Can get user to verify these, but dont want user to have to tap them in.
  • Create a connections properties file (we provide a mini JAR app to help with this) that will sit under Tomcat.
  • We have two WAR files for our actual web application. These can be split across two machines, but for now, lets assume they both get dumped under Tomcat.
  • Start Tomcat so that it deploys the WARs

This is a tedious process for our users
I want to encapsulate it into an installer and have been looking at doing this in NSIS which seems to have a large community, but then also stumbled across install4j, which although seems to be lesser known, is more specific to java based applications.

Just wanted to get some feedback from more experiennced users out there on the best choice for platform.

I do not want to get half way in, and then realise I have chosen the wrong installer platform.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

段念尘 2024-12-13 07:09:35

免责声明:我的公司开发 install4j。

首先,install4j是一个商业工具,所以这与NSIS有很大的区别。其他主要区别是:

  • install4j 是一个多平台安装程序构建器,适用于 Windows、Mac OS X 以及所有 POSIX 兼容的 Linux 和 Unix 平台。
  • install4j 的主要重点是安装基于 Java 的应用程序,例如,它处理启动器和服务的创建,并提供多种捆绑 JRE 的策略。 Java 应用程序所需的许多功能都可以开箱即用。
  • install4j 提供了自己的 IDE,重点关注易用性
  • 脚本是用 Java 完成的。 IDE 提供了一个内置编辑器,具有代码完成和错误分析功能。操作、屏幕和表单组件具有广泛的“脚本属性”,允许您自定义安装程序的行为。

对于 install4j,我可以满足您的单一要求:

确保计算机上有 JRE(32 或 64 位)

在媒体向导中,选择 JRE 捆绑包。如果选择“动态捆绑”选项,则仅在找不到合适的 JRE 时才会下载。

在此处输入图像描述

安装 Tomcat(32 或 64 位)

我建议只需将现有 tomcat 安装的根目录添加到您的分发树中。

至于服务,您可以使用 Tomcat 发行版中的 Tomcat 服务启动器,也可以在 install4j 中创建服务启动器。在这两种情况下,您都可以使用“安装服务”操作来安装服务。

生成的服务的优点是更新安装程序知道它们正在运行并在安装任何新文件之前自动关闭它们。

在此处输入图像描述

在 Oracle 或 SQL Server 中创建数据库(我们为此提供 SQL 脚本)

使用“运行可执行文件或批处理文件”操作来运行这些脚本。

将一些值写入我们的设置表,例如主机名。 (可以让用户验证这些,
但不希望用户必须点击它们。

任何类型的用户交互都是通过可配置的表单完成的。通过几个文本字段表单组件,您可以查询您的设置。

这在控制台安装程序中也可以透​​明地工作,自动生成的响应文件将允许您基于 GUI 安装程序的单次执行以无人值守模式自动安装。

在此处输入图像描述

创建一个连接属性文件(我们提供了一个迷你 JAR 应用程序来帮助完成此操作)
将位于 Tomcat 下。

如果您已经有一个可以执行此操作的 JAR 文件,只需将其添加到“安装程序”->“自定义代码和自定义代码”下即可。资源并向安装程序添加“运行脚本”操作以使用 JAR 文件中的类。

已保存到安装程序变量的表单组件中的任何用户输入都可以通过

context.getVariable("greetingOption")

“运行脚本”操作(或 install4j 中的任何其他脚本)的脚本属性中的调用来访问。

我们的实际 Web 应用程序有两个 WAR 文件。这些可以分为两部分
机器,但现在我们假设它们都被转储到 Tomcat 下。

如果您只是将 Tomcat 目录结构添加到分发树中,则可以预先部署这些 WAR 文件。否则,您可以使用“复制文件”操作将 WAR 文件放置在任何位置。

启动 Tomcat 以部署 WAR

启动 Tomcat,以便它部署通过“启动服务”操作完成的

Disclaimer: My company develops install4j.

First of all, install4j is a commercial tool, so that's a considerable difference to NSIS. Other major differences are:

  • install4j is a multi-platform installer builder for Windows, Mac OS X and all POSIX compatible Linux and Unix platforms.
  • install4j's main focus is for installing Java-based applications, for example it handles the creation of launchers and services and provides several strategies for bundling JREs. Many things that you need for a Java application will work out of the box.
  • install4j provides its own IDE which focuses on ease of use
  • Scripting is done in Java. The IDE provides a built-in editor with code-completion and error analysis. Actions, screens and form components have a wide range of "script properties" that allow you to customize the behavior of the installer.

For install4j, I can address your single requirements:

Ensure there is a JRE on machine (32 or 64bit)

In the media wizard, select a JRE bundle. If you select the "dynamic bundle" option, it will only be downloaded if no suitable JRE is found.

enter image description here

Install Tomcat (32 or 64bit)

I would recommend to simply add the root directory of an existing tomcat installation to your distribution tree.

As for the service, you can either use the Tomcat service launcher from the Tomcat distribution or create a service launcher in install4j. In both case you can use the "Install a service" action on order to install the service.

Generated services have the advantage that an update installer knows that they are running and automatically shuts them down before installing any new files.

enter image description here

Create a database in Oracle or SQL Server (we provide SQL scripts for this)

Use the "Run executable or batch file" action in order to run these scripts.

Write some values into our settings table, like hostname. (Can get user to verify these,
but dont want user to have to tap them in.

Any kind of user interaction is done with configurable forms. With a couple of text field form components you can query your settings.

This also works transparently in the console installer and the automatically generated response file will allow you to automate installations in unattended mode based on a single execution of the GUI installer.

enter image description here

Create a connections properties file (we provide a mini JAR app to help with this) that
will sit under Tomcat.

If you already have a JAR file which does that, just add it under Installer->Custom Code & Resources and add a "Run script" action to your installer to use the classes in your JAR file.

Any user input from form components that has been saved to installer variables can be accessed with calls like

context.getVariable("greetingOption")

in the script property of the "Run script" action (or any other script in install4j).

We have two WAR files for our actual web application. These can be split across two
machines, but for now, lets assume they both get dumped under Tomcat.

If you just add the Tomcat directory structure to your distribution tree, you can have these WAR file pre-deployed. Otherwise you can use "Copy file" actions to place the WAR files anywhere.

Start Tomcat so that it deploys the WARs

That's done with the "Start a service" action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文