4

我在打包JavaFX应用程序时遇到问题。
我的最终目的是生成独立的应用程序(*.jar、*.exe、*.dmg)。类和其他资源都可以,但是 jar 本身没有出现在“目标”文件夹中。也许有人可以给我一个提示,我做错了什么。或者也许有人可以提供简单的分步教程,如何达到我的目的(不幸的是,我没有按照 Oracle 指南做到这一点)。
提前致谢!
这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>EmployeeReview</artifactId>
<version>1.0</version>

<name>EmployeeReview</name>

<properties>
    <commons-poi.version>3.8</commons-poi.version>
    <joda-time.version>2.1</joda-time.version>
    <simple-odf.version>0.6.6</simple-odf.version>

    <maven-compiler-plugin.version>2.5.1</maven-compiler-plugin.version>
    <maven-antrun-plugin.version>1.7</maven-antrun-plugin.version>
    <maven-assembly-plugin>2.3</maven-assembly-plugin>

    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>

    <exec.mainClass>by.issoft.employeereview.form.MainForm</exec.mainClass>

    <javafx.tools.ant.jar>${java.home}/lib/ant-javafx.jar</javafx.tools.ant.jar>
    <javafx.runtime.lib.jar>${java.home}/jre/lib/jfxrt.jar</javafx.runtime.lib.jar>

    <javafx.min.version>2.2</javafx.min.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${commons-poi.version}</version>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda-time.version}</version>
    </dependency>

    <dependency>
        <groupId>org.odftoolkit</groupId>
        <artifactId>simple-odf</artifactId>
        <version>${simple-odf.version}</version>
    </dependency>

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>javafx</artifactId>
        <version>${javafx.min.version}</version>
        <scope>compile</scope>
    </dependency>
</dependencies>

<build>
    <directory>target</directory>
    <finalName>EmployeeReview</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>${maven-antrun-plugin.version}</version>
            <executions>
                <execution>
                    <id>create-launcher-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                            <taskdef
                                    uri="javafx:com.sun.javafx.tools.ant"
                                    resource="com/sun/javafx/tools/ant/antlib.xml"
                                    classpath="${javafx.tools.ant.jar}"/>
                            <fx:application id="fxApp"
                                            name="${project.name}"
                                            mainClass="${exec.mainClass}"/>
                            <fx:jar destfile="${project.build.directory}/${project.build.finalName}-launcher">
                                <fx:application refid="fxApp"/>
                                <fx:fileset dir="${project.build.directory}/classes"/>
                            </fx:jar>
                            <attachartifact
                                    file="${project.build.directory}/${project.build.finalName}-launcher.jar"
                                    classifier="launcher" />
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>


    </plugins>
</build>

4

0 回答 0