+-
使用maven和IntelliJ的OpenJFX 14:无法运行应用程序。

我试图在IntelliJ的JDK 14 Java项目上使用OpenJFX.我的项目有多个IntelliJ模块,每个模块都有一个pom.xml。

在包含我的main的IntelliJ模块中,我已经添加了JFX作为依赖。

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>14</version>
    <type>pom</type>
</dependency>

在我的顶层pom.xml中,我添加了JFX插件。

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.4</version>
    <configuration>
        <mainClass>fr.efrei.wiemetarsene.caspersky.app.Main</mainClass>
    </configuration>
</plugin>

但是当我尝试用.NET Framework运行我的应用程序时,我得到了以下错误信息: :

mvn javafx:run

我得到以下错误。

[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.4:run (default-cli) on project caspersky: Error: Output directory is empty, compile first -> [Help 1]

我试着在做之前运行 :

mvn compiler:compile

但结果是完全一样的。你有什么线索,为什么它不工作?

1
投票

从那里 README你可以尝试以下变化。

<plugin>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-maven-plugin</artifactId>
    <version>0.0.4</version>
    <configuration>
        <source>14</source>
        <target>14</target>
        <release>14</release>
        <mainClass>fr.efrei.wiemetarsene.caspersky.app.Main</mainClass>
    </configuration>
</plugin>

另外,编译你的项目时使用

mvn javafx:compile

但由于 文档可能已经过时,你可以尝试执行

mvn compile

mvn clean javafx:jlink