使用JavaSDK11.0.6构建可执行的JavaFX应用程序

使用JavaSDK11.0.6构建可执行的JavaFX应用程序,java,maven,javafx-11,jlink,Java,Maven,Javafx 11,Jlink,我有一个JavaFX应用程序,我已经成功地用JavaSDK1.8构建并运行了它。我正试图将其迁移到Java11,最终目标是使用Java14,但无法创建可运行的jar。为了尝试理解这个过程,我下载了JavaFXHellofx示例,并尝试按照for Maven的说明进行操作。运行mvn clean javafx:jlink时,出现以下错误: [INFO] Scanning for projects... [INFO] [INFO] ------------------------< org.o

我有一个JavaFX应用程序,我已经成功地用JavaSDK1.8构建并运行了它。我正试图将其迁移到Java11,最终目标是使用Java14,但无法创建可运行的jar。为了尝试理解这个过程,我下载了JavaFXHellofx示例,并尝试按照for Maven的说明进行操作。运行mvn clean javafx:jlink时,出现以下错误:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofx ---
[INFO] Deleting C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) @ hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\src\main\resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.345 s
[INFO] Finished at: 2020-04-14T14:52:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:jlink (default-cli) on project hellofx: Error: jlink requires a module descriptor -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO]正在扫描项目。。。
[信息]
[信息]----------------------------------------------------
[信息]构建演示1.0-SNAPSHOT
[信息]------------------------------------[jar]---------------------------------
[信息]
[信息]---maven clean插件:2.5:clean(默认清洁)@hellofx---
[信息]删除C:\Users\jungl\eclipse workspace\helloFX\Maven\helloFX\target
[信息]
[信息]---javafxmaven插件:0.0.3:jlink(默认cli)@hellofx---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]跳过不存在的资源目录C:\Users\jungl\eclipse workspace\helloFX\Maven\helloFX\src\main\resources
[信息]检测到更改-重新编译模块!
[INFO]正在将1个源文件编译为C:\Users\jungl\eclipse workspace\helloFX\Maven\helloFX\target\classes
[信息]------------------------------------------------------------------------
[信息]生成失败
[信息]------------------------------------------------------------------------
[信息]总时间:2.345秒
[信息]完成时间:2020-04-14T14:52:18+01:00
[信息]------------------------------------------------------------------------
[错误]无法在hellofx项目上执行目标组织。openjfx:javafx maven插件:0.0.3:jlink(默认cli):错误:jlink需要模块描述符->[帮助1]
[错误]
[错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[错误]使用-X开关重新运行Maven以启用完整调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误][帮助1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
xml是

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.openjfx</groupId>
  <artifactId>hellofx</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>demo</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>11</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>0.0.3</version>
        <configuration>
          <mainClass>HelloFX</mainClass>
      <jlinkImageName>hello></jlinkImageName>
      <jlinkZipName>hellozip></jlinkZipName>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
<!-- https://mvnrepository.com/artifact/com.zenjava/javafx-maven-plugin -->

4.0.0
org.openjfx
海洛夫
罐子
1.0-快照
演示
http://maven.apache.org
UTF-8
org.openjfx
javafx控件
11
org.openjfx
javafxmaven插件
0.0.3
海洛夫
你好>
hellozip>

有人能给我指出正确的方向吗,因为我无法理解这个问题。

提供的示例没有按照教程所说的那样结构化。maven版本已在命令行文件夹下更新。如果转到:..\CommandLine\Modular\Maven\helloFX并输入命令mvn clean javafx:run、clean javafx:jlink、target\helloFX\bin\launcher,它将按照教程中的说明运行。

提供的示例的结构与教程中的不同。maven版本已在命令行文件夹下更新。如果转到:…\CommandLine\Modular\Maven\helloFX并输入命令mvn clean javafx:run、clean javafx:jlink、target\helloFX\bin\launcher,它将按照教程中的说明运行