如何在自包含的应用程序JavaFX .deb(Debian)包上设置安装路径

时间:2018-05-29 18:27:59

标签: java javafx ant dpkg self-contained

我尝试使用self-contained copy of my JavaFX application生成包含Oracle JavaFX Ant fx:deploy Task.deb文件。

I've followed the samples on official documentation和我的pom.xml配置如下所示:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <phase>install</phase>
            <configuration>
                <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                    <manifestclasspath property="manifest.classpath" jarfile="${application.dist}/${jar.name}.jar">
                        <classpath>
                            <path id="build.classpath">
                                <fileset dir="${application.dist}/lib">
                                    <include name="*.jar"/>
                                </fileset>
                            </path>
                        </classpath>
                    </manifestclasspath>


                    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
                             uri="javafx:com.sun.javafx.tools.ant"
                             classpath="${project.basedir}:${javafx.lib.ant-javafx.jar}"/>

                    <fx:preferences id="fxPreferences" shortcut="true" menu="true" install="true"/>

                    <fx:jar destfile="${application.dist}/${jar.name}.jar">
                        <fx:application name="${application.title}"
                                        mainClass="${application.main.class}"/>
                        <manifest>
                            <attribute name="Class-Path" value="${manifest.classpath}"/>
                        </manifest>
                        <!-- The target/classes folder which contains all resources and
                                    class files -->
                        <fileset dir="${project.build.outputDirectory}"/>
                    </fx:jar>

                    <fx:resources id="appRes">
                        <fx:fileset dir="${classes.dir}" includes="*.ico"/>
                        <fx:fileset dir="${classes.dir}" includes="*.bat"/>
                        <fx:fileset dir="${classes.dir}" includes="*.conf"/>
                        <fx:fileset dir="${application.dist}" includes="*.jar"/>
                        <fx:fileset dir="${application.dist}" includes="lib/*.jar"/>
                        <fx:fileset dir="${java.home}/lib/ext" includes="sunjce_provider.jar" type="data"/>
                        <fx:fileset dir="${java.home}/bin" includes="java.exe" type="data"/>
                        <fx:fileset dir="${java.home}/bin" includes="javaw.exe" type="data"/>
                        <fx:fileset dir="${extra.dir}" includes="**"/>
                    </fx:resources>


                    <!-- This same fx:deploy task MUST be able to generate a Windows .EXE bundle as well -->
                    <fx:deploy verbose="true" embedJNLP="false" extension="false" includeDT="false"
                               offlineAllowed="true" outdir="${application.dist}"
                               outfile="${bundle.name}" nativeBundles="all" updatemode="background">
                        <fx:application name="${application.name}" mainClass="${application.main.class}"/>
                        <fx:resources refid="appRes"/>
                        <fx:preferences refId="fxPreferences" shortcut="true" menu="true"/>
                        <fx:info title="${application.title}" vendor="${application.vendor}"/>


                        <fx:platform javafx="8.0+">
                            <fx:jvmarg value="-Djava.security.debug=sunpkcs11"/>
                        </fx:platform>
                    </fx:deploy>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

在构建结束时(mvn clean install),.deb文件在/target/dist/bundles文件夹中正确生成。

但是当我使用dpkg -i安装它时,我的应用程序将安装在/opt/${bundle.name}

DEB packaging options documentation表示默认安装位置为/opt,但它不告诉我如何更改它。

我的问题是:如何设置其他安装路径以覆盖默认的/opt值?

例如,如果我可以将其安装在/opt/company/apps/${bundle.name}上,那就太棒了。

我已经了解了fx:deploy中fx:bundleArgument的使用情况,它有固定的选项。但是没有关于安装路径的linux.*选项。

环境信息:

  • Debian 8.10 Jessie
  • JDK 1.8.0_171 64bits
  • dpkg-deb 1.17.27(amd64)
  • Apache Maven 3.0.5

0 个答案:

没有答案