java - 马文 : Build native installer of javaFX application with Inno Setup script

标签 java maven javafx inno-setup

最近我完成了一个 JavaFX 项目,现在我想为 Windows 创建 native 安装程序。我正在使用 exec-maven-plugin创建一个安装程序,它工作正常并使用 inno 安装脚本的默认设置生成 exe 文件。

我创建了一个名为 [project-name].iss 的 inno 安装脚本,并将其放在 app\src\main\deploy\package\windows\[project-name].iss 中.

我的maven插件代码看起来像

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>package-jar</id>
            <phase>package</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>
                    ${env.JAVA_HOME}/bin/javapackager
                </executable>
                <arguments>
                    <argument>-createjar</argument>
                    <argument>-appclass</argument>
                    <argument>${app.main.class}</argument>
                    <argument>-srcdir</argument>
                    <argument>
                        ${project.build.directory}/classes
                    </argument>
                    <argument>-outdir</argument>
                    <argument>./target</argument>
                    <argument>-outfile</argument>
                    <argument>
                        ${project.artifactId}-app
                    </argument>
                    <argument>-v</argument>
                </arguments>
            </configuration>
        </execution>
        <execution>
            <id>package-jar2</id>
            <phase>package</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>
                    ${env.JAVA_HOME}/bin/javapackager
                </executable>

                <arguments>
                    <argument>-deploy</argument>
                    <argument>-native</argument>
                    <argument>installer</argument>
                    <argument>-appclass</argument>
                    <argument>${app.main.class}</argument>
                    <argument>-srcfiles</argument>
                    <argument>
                        ${project.build.directory}/${artifactId}-app.jar
                    </argument>
                    <argument>-outdir</argument>
                    <argument>./target</argument>
                    <argument>-outfile</argument>
                    <argument>
                        ${project.artifactId}-app
                    </argument>
                    <argument>-v</argument>
                </arguments>
            </configuration>
        </execution>

    </executions>
</plugin>

[project-name].iss 文件看起来像

[Setup]
AppName=Project Name
AppId=ProjectName
AppVersion=0.1.0
AppPublisher=Project Name
AppPublisherURL=http://www.todo.com/
AppSupportURL=http://www.todo.com/
AppUpdatesURL=http://www.todo.com/
MinVersion=5.1
DefaultDirName={pf}\Project Name
DefaultGroupName=Project Name
AllowNoIcons=yes
Compression=lzma2/ultra
InternalCompressLevel=ultra
SolidCompression=yes
SetupIconFile=icon.ico
AllowCancelDuringInstall=false

但是在 maven 包之后,我得到的可执行文件没有来自上面的 inno 安装脚本的任何属性。(我还将 icon.ico 文件放在 app\src\main\deploy\package\windows\icon.ico 中)

打包app时输出日志(默认不使用[project-name].iss脚本配置) enter image description here

那么你能帮我解决我在 maven 插件或其他任何东西中遗漏的任何配置吗?

谢谢。

最佳答案

你可以试试 JavaPackager Maven Plugin .它不依赖于 javapackager 工具。

您的 POM 只需包含如下内容:

<plugin>
    <groupId>io.github.fvarrui</groupId>
    <artifactId>javapackager</artifactId>
    <version>0.9.4</version>    
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>package</goal>
            </goals>
            <configuration>
                <name>ProjectName</name>
                <version>0.1.0</version>
                <url>http://www.todo.com/</url>
                <mainClass>${app.main.class}</mainClass>
                <bundleJre>true</bundleJre>
                <iconFile>src/main/deploy/package/windows/icon.ico</iconFile>
            </configuration>
        </execution>
    </executions>
</plugin>

并且该插件将为您的应用程序生成一个安装程序,其中包含一个捆绑和自定义的 JRE。它会为您完成所有工作,因此您不必担心任何 ISS 文件。

关于java - 马文 : Build native installer of javaFX application with Inno Setup script,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29273279/

相关文章:

java - TextField空指针异常

java - 如何为 JavaFX 舞台创建调整大小动画?

java - RoboBinding:firePropertyChange() 上没有此类属性异常

java - 在共享首选项中存储一维字符串数组

java - Spring Boot Admin,客户端注册导致错误请求

java - Maven包错误

java - 如何将 javaFX 14 应用程序导出为 IntelliJ 中的可执行文件?

java - Lucene A-Z 列表

java - 静态实例上的模拟方法

java - 如何在我的maven项目中导入FFMPEG库?