为什么我的 JavaFX 17 应用程序不是使用 Gluon 构建的?记录为 JNI / 反射问题

Why is my JavaFX 17 Application not building with Gluon ? Logged as JNI / Reflection problem

我正在关注 Gluon 提供的文档:here
为了尽量让它变得简单,我将尝试直截了当地给出我所经历的里程碑,以及我遇到的困难。

------------ 环境:
OS : Windows 10 x64
IDE: Eclipse,版本:2021-12 (4.22.0)
JAVA:jdk17.0.1
JAVAFX:javafx-sdk-17.0.1
GraalVM : graalvm-svm-java17-windows-gluon-22.0.0.2-Final
Eclipse 的 Gluon 插件: 2.8.2
Visual Studio : 1.63.2(包含文档中描述的所有必需扩展)
维克斯: 3.11.2.24516

------------ 配置
Maven:apache-maven-3.8.4
Pom : 这是我的 POM 的第一部分的屏幕截图,可以找到 here
环境变量: JAVA_HOME + GRAALVM_HOME + MAVEN_HOME


------------ 完成:
JavaFX(v17) 应用程序:

---------- 问题:
无法完成 Gluon 目标“mvn gluonfx:build”或“gluonfx:build”!这是我所做的:

  1. 按照指示执行 here:“如果您在 Windows 上 运行ning,则需要从 x64 终端 运行 所有 GluonFX 目标。” ,我打开“VS 2022 的 x64 本机工具命令提示符”
  2. 导航到 POM 所在的我的项目文件夹。
  3. 运行指令mvn gluonfx:build。我还尝试按照建议“打开 运行 配置… window 并将目标更新为 gluonfx:build 并单击 运行” 的说明进行操作。两者都会导致失败! post 结尾的终端报告显示:

几天来我一直在努力扭转一切,并在网上搜索一些线索......但直到现在都没有运气:-(......有人可以帮我解决这个问题吗?

PS。我确实使用了一个外部 DLL(是的,仅 Windows,但是嘿:我们在这里尝试进行 NATIVE 构建,因此,在 Windows ;-) 中应该没问题);这个 DLL 是 JNI 附加的。我也试过玩这个……运气不好。

------------ 终端报告:
(如前所述,完整日志,here

D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler>mvn gluonfx:build
[INFO] Scanning for projects...
[INFO]
[INFO] --< com.plpr.application:gluon-mobile---single-view-project--allow-incomplete-classpath >--
[INFO] Building Gluon Mobile - Single View Project 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.8:build (default-cli) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Scanning for projects...
[INFO]
[INFO] --< com.plpr.application:gluon-mobile---single-view-project--allow-incomplete-classpath >--
[INFO] Building Gluon Mobile - Single View Project 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> gluonfx-maven-plugin:1.0.8:compile (default-cli) > process-classes @ gluon-mobile---single-view-project--allow-incomplete-classpath >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< gluonfx-maven-plugin:1.0.8:compile (default-cli) < process-classes @ gluon-mobile---single-view-project--allow-incomplete-classpath <<<
[INFO]
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.8:compile (default-cli) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[lun. févr. 07 15:17:25 CET 2022][INFO] ==================== COMPILE TASK ====================
             _______  ___      __   __  _______  __    _
            |       ||   |    |  | |  ||       ||  |  | |
            |    ___||   |    |  | |  ||   _   ||   |_| |
            |   | __ |   |    |  |_|  ||  | |  ||       |
            |   ||  ||   |___ |       ||  |_|  ||  _    |
            |   |_| ||       ||       ||       || | |   |
            |_______||_______||_______||_______||_|  |__|

    Access to the latest docs, tips and tricks and more info on
    how to get support? Register your usage of Gluon Substrate now at

    https://gluonhq.com/activate



[lun. févr. 07 15:17:26 CET 2022][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
[lun. févr. 07 15:17:28 CET 2022][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] GraalVM Native Image: Generating 'com.plpr.application.gluonapplication'...
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] [1/7] Initializing...
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]                                                                                     (4,2s @ 0,16GB)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Error: Error parsing JNI configuration in D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\jniconfig-x86_64-windows.json:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Field java.net.Inet6Address.cached_scope_id not found. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationFiles.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: Error parsing JNI configuration in D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\jniconfig-x86_64-windows.json:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Field java.net.Inet6Address.cached_scope_id not found. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationFiles.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:135)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations(ConfigurationParserUtils.java:86)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline.accept(ReferencePipeline.java:214)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline.accept(ReferencePipeline.java:197)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline.accept(ReferencePipeline.java:197)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:515)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:473)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:88)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.jni.access.JNIAccessFeature.afterRegistration(JNIAccessFeature.java:128)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage(NativeImageGenerator.java:802)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:802)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:534)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]                          0,1s (3,0% of total time) in 8 GCs | Peak RSS: 0,85GB | CPU load: 5,50
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Produced artifacts:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]  D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\Gluon Mobile - Single View Project\com.plpr.application.gluonapplication.build_artifacts.txt
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Failed generating 'com.plpr.application.gluonapplication' after 2,3s.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Error: Image build request failed with exit status 1
[lun. févr. 07 15:17:31 CET 2022][SEVERE] Process compile failed with result: 1
Check the log files under D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[lun. févr. 07 15:17:31 CET 2022][INFO] Logging process [compile] to file: D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\log\process-compile-1644243451215.log
[lun. févr. 07 15:17:31 CET 2022][SEVERE] Compiling failed.
Check the log files under D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.934 s
[INFO] Finished at: 2022-02-07T15:17:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.8:compile (default-cli) on project gluon-mobile---single-view-project--allow-incomplete-classpath: Compiling failed -> [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] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  8.723 s
[INFO] Finished at: 2022-02-07T15:17:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.8:build (default-cli) on project gluon-mobile---single-view-project--allow-incomplete-classpath: Error, gluonfx:build failed -> [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

José Pereda, which has an amazing 'Coding Blog' here,发现我的插件版本已过时。
他指出在开发过程中使用了2个插件:

  • IDE 一个,在我的例子中是 Eclipse,最新的是 2022.02.08,是 2.8.2。
  • 'POM'一个,默认设置为1.0.8,我不得不设置为1.0.12。
    这解决了我的问题中描述的问题。这是更新后的 POM 的截图,可以找到 here :


    我发现的另一个问题是本机构建的自定义参数 --allow-incomplete-classpath 设置不正确。它必须在 plugin/configuration 部分的 'POM' 中设置如下(已引用相同的 POM):


    这 2 个修改使我能够完成构建,并且我的 'exe' 文件已创建!