我试图在IntelliJ的JDK 14 Java项目上使用OpenJFX。我的项目有多个IntelliJ模块,每个模块都有pom.xml。
在包含我的主要对象的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>
但是当我尝试使用以下命令运行我的应用程序时:
mvn javafx:run
Il得到以下错误:
[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
在此之前,但结果完全相同。您对它为什么不起作用有任何线索吗?
我有多模块javafx项目,遇到了同样的错误。主类在我的View模块中。在pom文件中,我有:
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.5</version>
<configuration>
<source>14</source>
<target>14</target>
<release>14</release>
<mainClass>Main</mainClass>
</configuration>
</plugin>
然后在终端输入:
mvn install
cd View
mvn javafx:run
在代码中进行了一些更改之后,我经常会收到一些奇怪的错误,例如缺少组件。然后重复上述步骤即可解决问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句