Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven:使用Inno安装脚本构建javaFX应用程序的本机安装程序_Java_Maven_Javafx_Inno Setup - Fatal编程技术网

Maven:使用Inno安装脚本构建javaFX应用程序的本机安装程序

Maven:使用Inno安装脚本构建javaFX应用程序的本机安装程序,java,maven,javafx,inno-setup,Java,Maven,Javafx,Inno Setup,最近我完成了一个JavaFX项目,现在我想为windows创建本机安装程序。我正在使用execmaven plugin创建一个安装程序,它工作正常,并使用inno安装脚本的默认设置生成exe文件 我创建了一个名为[project name].iss的inno安装脚本,并将其放置在app\src\main\deploy\package\windows\[project name].iss中 我的maven插件代码看起来像 <plugin> <groupId>org.

最近我完成了一个JavaFX项目,现在我想为windows创建本机安装程序。我正在使用
execmaven 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>
但在maven软件包之后,我得到的可执行文件并没有上面inno安装脚本中的任何属性。(我还将icon.ico文件放在
app\src\main\deploy\package\windows\icon.ico
中)

打包应用程序时输出日志(默认情况下不使用[project name].iss脚本配置)

所以,你能帮我任何配置,我在maven插件或任何其他缺失

谢谢。

(即使这是一个老问题,其他人也可能会搜索)

您需要注意正确的文件名,使用的appName负责javapackager搜索的文件名

由于您没有提供一些
-name
-parameter,appName是从提供的主类(
appclass
-parameter)收集的,它甚至打印在命令日志中,使用
main.ico
。因此,您需要添加以下内容:

<argument>-name</argument>
<argument>${project.artifactId}</argument>
-名称
${project.artifactId}
这意味着
.ico
-文件的文件名必须是
${project.artifactId}.ico
,位于
app/src/main/deploy/windows
-文件夹下方。

您可以尝试。它不依赖于
javapackager
工具

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


io.github.fvarrui
javapackager
0.9.4    
包裹
包裹
项目名称
0.1.0
http://www.todo.com/
${app.main.class}
真的
src/main/deploy/package/windows/icon.ico

该插件将为您的应用程序生成一个带有捆绑和定制JRE的安装程序。它将为您完成所有工作,因此您不必担心任何ISS文件。

谢谢@GhiOm我已经在我的项目中使用JavaFX Maven插件实现了它(与您提到的相同)。:)但我最近几天很忙,所以我没有时间发布解决方案,我很快就会发布。
<argument>-name</argument>
<argument>${project.artifactId}</argument>