JavaFX使用maven在Linux下构建Windows自包含应用程序包

时间:2017-10-05 15:44:20

标签: java maven jenkins javafx

我使用多模块maven项目在Windows for Windows下创建一个自包含的应用程序包(使用exe和嵌入式JRE)。

但我无法在Linux下找到如何使用Jenkins进行此操作。我提供了32位Windows JDK / JRE(因为我们必须使用JNI DLL)但是我收到一条错误消息(s.below),表明该任务需要构建Linux映像,因为它在Linux下运行。

是否有可能说服DeployFXTask他必须构建一个跨平台的Windows软件包?

  

ERRORMESSAGE:由于配置问题而跳过Bundler Linux应用程序映像:此ant-javafx.jar副本不支持Linux。

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <JAVA.JDK.HOME>${project.basedir}/../myapp-env/target/jdk-win32</JAVA.JDK.HOME>
    <JAVA.JRE.HOME>${JAVA.JDK.HOME}/jre</JAVA.JRE.HOME>
    <JAVAFX.TOOLS.ANT.JAR>${JAVA.JDK.HOME}/lib/ant-javafx.jar</JAVAFX.TOOLS.ANT.JAR>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>set-system-properties</goal>
                    </goals>
                    <configuration>
                        <properties>
                            <property>
                                <name>fxpackager.disableBitArchitectureMismatchCheck</name>
                                <value>true</value>
                            </property>
                        </properties>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- do the JavaFX magic via ant tasks -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>

            <executions>
                <execution>
                    <id>build-javafx.developer</id>
                    <phase>package</phase>
                    <!-- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html  -->
                    <!-- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/javafx_ant_task_reference.html -->
                    <!-- https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html -->
                    <configuration>
                        <target>
                            <property name="JAVA_HOME" value="${JAVA.JDK.HOME}"/>

                            <!-- also include icons into path - icons must be named equal to the application name -->
                            <path id="javafx.path">
                                <filelist>
                                    <file name="${JAVAFX.TOOLS.ANT.JAR}"/>
                                    <file name="${project.basedir}/src/main/resources/"/>
                                </filelist>
                            </path>

                            <!-- merge PDF, CSV and Maps into myappDeveloper.jar -->
                            <zip destfile="${project.build.outputDirectory}/myappDeveloper.jar">
                                <zipfileset
                                        dir="${project.basedir}/../myapp-generate-resources/target/classes/de/db/myapp/csv"
                                        prefix="de/db/myapp/csv"/>
                                <zipfileset
                                        dir="${project.basedir}/../myapp-generate-resources/target/classes/de/db/myapp/pdf"
                                        prefix="de/db/myapp/pdf"/>
                                <zipfileset
                                        dir="${project.basedir}/../myapp-generate-resources/target/classes/de/db/myapp/map"
                                        prefix="de/db/myapp/map"/>
                                <zipgroupfileset
                                        file="${project.basedir}/../myapp-core/target/myappDeveloper.jar"/>
                            </zip>

                            <!-- define the deploy ANT task-->
                            <taskdef
                                    name="dev.jfxdeploy"
                                    classname="com.sun.javafx.tools.ant.DeployFXTask"
                                    classpathref="javafx.path"/>

                            <dev.jfxdeploy
                                    width="1024"
                                    height="768"
                                    outdir="${project.build.directory}/deployDeveloper"
                                    outfile="${project.build.finalName}"
                                    nativeBundles="image"
                                    runtime="${JAVA.JRE.HOME}">

                                <info title="${project.name}" vendor="MyApp"
                                      description="myappstool"/>
                                <application
                                        name="myappDeveloper"
                                        mainClass="de.db.myapp.MainDeveloper"/>
                                <resources>
                                    <fileset
                                            dir="${project.build.outputDirectory}"
                                            includes="myappDeveloper.jar"/>
                                    <fileset
                                            dir="${project.build.directory}"
                                            includes="myapp-tool-1.0.0-SNAPSHOT.jar"/>
                                    <fileset
                                            dir="${project.basedir}/../myapp-dll/target/classes"
                                            includes="**/*.dll"/>
                                    <fileset
                                            dir="${project.basedir}/../myapp-dll/target/classes"
                                            includes="data/**"/>
                                </resources>

                                <!-- Custom JVM setup for application -->
                                <platform >
                                    <jvmarg value="-Xmx1024m"/>
                                    <jvmarg value="-verbose:jni"/>
                                </platform>

                                <!-- install for current user only -->
                                <preferences install="false" shortcut="true"/>
                                <!-- Windows Menü -->
                                <bundleArgument arg="win.menuGroup" value="MyApp"/>
                            </dev.jfxdeploy>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>

            </executions>
        </plugin>
    </plugins>

</build>

0 个答案:

没有答案