如何在 javafx-ant、maven 和 INNO 中使用自定义 *.ISS?

How to use custom *.ISS with javafx-ant, maven and INNO?

我正在尝试使用 maven、inno 和 javafx-ant 为我的应用程序创建自定义安装程序。我看过这个 link,但我似乎没有得到描述的结果 Inno and Maven

我已成功创建安装程序,并且已成功安装我的应用程序。但是它总是转到 user/AppData/Local/。我在我的自定义 *.iss 文件中将其更改如下:

DefaultDirName={pf}\cashreceipts
UsePreviousAppDir=No
Uninstallable=yes

但是在构建过程中未选取此文件。我已经在 src/main/deploy/package/windows/application-name.iss 添加了所需的 application-name.iss 文件,但是它没有启动。

我不确定还有什么方法可以尝试在我的构建中使用此文件。

谢谢!

以下是构建步骤的maven配置。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <configuration>
                        <target>
                            <!-- define the deploy ANT task -->
                            <taskdef name="jfxdeploy"
                                classname="com.sun.javafx.tools.ant.DeployFXTask"
                                classpathref="maven.plugin.classpath" />

                            <!-- define the JarSing ANT task -->
                            <!-- taskdef name="jfxsignjar"
                                classname="com.sun.javafx.tools.ant.FXSignJarTask" 
                                classpathref="maven.plugin.classpath" / -->
                            <jfxdeploy outdir="${project.build.directory}/deploy"
                                outfile="${project.build.finalName}" nativeBundles="all"
                                verbose="true">
                                <info title="${project.name}" />

                                <!-- set the main class of your applcation -->
                                <application name="${project.name}"
                                    mainClass="com.mycompany.myclass" />
                                <resources>
                                    <fileset dir="${project.build.directory}"
                                        includes="*.jar" />
                                    <fileset dir="${project.build.directory}/dependency"
                                        includes="*.jar" />
                                    <fileset dir="${project.build.directory}"
                                        includes="properties/*.properties"/>
                                </resources>

                                <!-- set your jvm args -->
                                <platform>
                                    <jvmarg value="-Xms512m" />
                                    <jvmarg value="-Xmx1024m" />
                                </platform>
                            </jfxdeploy>
                            <!-- you need to generate a key yourself -->
                            <!--jfxsignjar destdir="${project.build.directory}/deploy"
                                keyStore="path/to/your/keystore" storePass="yourPass"
                                alias="yourAlias" keyPass="keyPass">
                                <fileset dir="${project.build.directory}/deploy" 
                                includes="*.jar" /> </jfxsignjar -->
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>

            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ant-javafx</artifactId>
                    <version>${javafx.version}</version>
                    <systemPath>${java.home}/../lib/ant-javafx.jar</systemPath>
                    <scope>system</scope>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
    <finalName>cashreceipts</finalName>
</build>

我能够确认 ZENJAVA 插件仍在开发中,并在 github 得到支持,它可以完成此任务。资料在这里:

我更新后的 pom.xml 看起来像这样:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>myapp</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>myapp</name>
<url>http://www.mycompany.com</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <javafx.version>8.0</javafx.version>
</properties>


<repositories>
    <repository>
        <id>repo</id>
        <url>file://${project.basedir}/lib/repo</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <!-- new SNAPSHOT version needed to work with current JavaFX Version -->
        <id>com.zenjava</id>
        <url>file://C:\Users\username\Desktop\maven fx plugin\javafx-maven-plugin-master\javafx-maven-plugin-master\target</url>
    </pluginRepository>
</pluginRepositories>


<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>

            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>

        <plugin>
            <!-- copy all dependencies of your app to target folder -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <configuration>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                    </configuration>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <archive>
                    <manifestEntries>
                        <Main-Class>com.mycompany.app.MyApp</Main-Class>
                        <implementation-version>1.0</implementation-version>
                        <JavaFX-Application-Class>com.mycompany.app.MyApp</JavaFX-Application-Class>
                    </manifestEntries>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
            </configuration>
        </plugin>

        <!-- copy the properties files to the root location -->
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <id>copy-resources-1</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/target/additionalResources/properties</outputDirectory>
                        <resources>
                            <resource>
                                <directory>properties</directory>
                                <filtering>true</filtering>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
                <groupId>com.zenjava</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>8.1.3-SNAPSHOT</version>
                <configuration>
                    <mainClass>com.mycompany.app.MyApp</mainClass>
                    <verbose>true</verbose>
                    <bundler>EXE</bundler>
                    <additionalAppResources>${project.build.directory}/additionalResources</additionalAppResources>
                </configuration>
                <executions> 
                 <!-- required before build-native --> 
                 <execution> 
                     <id>create-jfxjar</id> 
                     <phase>package</phase> 
                     <goals> 
                         <goal>build-jar</goal> 
                     </goals> 
                 </execution> 
                 <execution> 
                     <id>create-native</id> 
                     <phase>package</phase> 
                     <goals> 
                         <goal>build-native</goal> 
                     </goals> 
                 </execution> 
             </executions> 

        </plugin>

        </plugins>
    <finalName>myapp</finalName>
</build>

<dependencies>
    <dependency>
        <groupId>org.controlsfx</groupId>
        <artifactId>controlsfx</artifactId>
        <version>8.40.9</version>
    </dependency>

    <dependency>
        <groupId>customjar</groupId>
        <artifactId>mycustomjar</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>

<organization>
    <name>My Company</name>
    <url>www.mycompany.com</url>
</organization>