Windows 上 JavaFX 的 Gluon 客户端 maven 插件无法编译?

问题描述 投票:0回答:2

我一直在为我的一个项目在 Windows 机器上试验 Gluon 的客户端 maven 插件。我决定尝试他们的“hello world”示例之一,这里。我遵循了有关如何配置机器的所有步骤。

但是,我遇到了一些错误。由于某种原因,编译总是失败并给我一个错误“无法运行程序“cl””。有人知道如何解决这个问题吗?

我在“VS 2019 的 x64 本机工具命令提示符”窗口中运行 client:build 命令。

日志如下:

java.io.IOException: Cannot run program "cl" (in directory "C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml"): CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.util.ProcessRunner.setupProcess(ProcessRunner.java:336)
[INFO] BUILD FAILURE
        at com.gluonhq.substrate.util.ProcessRunner.runProcess(ProcessRunner.java:194)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.substrate.target.AbstractTargetConfiguration.compileAdditionalSources(AbstractTargetConfiguration.java:330)
[INFO] Total time:  2.860 s
        at com.gluonhq.substrate.target.AbstractTargetConfiguration.compile(AbstractTargetConfiguration.java:130)
[INFO] Finished at: 2020-06-02T17:37:39-04:00
        at com.gluonhq.substrate.SubstrateDispatcher.nativeCompile(SubstrateDispatcher.java:414)
[INFO] ------------------------------------------------------------------------
        at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:54)
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.26:compile (default-cli) on project hellofxml: Error: Cannot run program "cl" (in directory "C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] For more information about the errors and possible solutions, please read the following articles:
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:420)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:151)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
        ... 29 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.141 s
[INFO] Finished at: 2020-06-02T17:37:39-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.26:build (default-cli) on project hellofxml: Error, client: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

当我将 C:\Program Files (x86)\Microsoft Visual Studio�9\Community\VC\Tools\MSVC .25.28610 in\HostX64\x64 添加到我的系统路径时,插件在日志中给出以下错误。 (我在管理员模式下运行这个命令)

[Tue Jun 02 18:28:07 EDT 2020][INFO] ==================== COMPILE TASK ====================
[Tue Jun 02 18:28:08 EDT 2020][FINE] PB Command for check version: D:\graalvm-ce-java11-20.2.0-dev\bin\java -version
[Tue Jun 02 18:28:08 EDT 2020][FINE] Start process check version...
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] openjdk version "11.0.7" 2020-04-14
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] OpenJDK Runtime Environment GraalVM CE 20.2.0-dev (build 11.0.7+10-jvmci-20.1-b02)
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] OpenJDK 64-Bit Server VM GraalVM CE 20.2.0-dev (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
[Tue Jun 02 18:28:09 EDT 2020][FINE] Result for check version: 0
[Tue Jun 02 18:28:09 EDT 2020][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
[Tue Jun 02 18:28:09 EDT 2020][FINE] Extracting native libs to: C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\lib
[Tue Jun 02 18:28:09 EDT 2020][FINE] Looking for resource: /native/windows/launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] PB Command for compile-additional-sources: cl -c -DSUBSTRATE /MD /D_UNICODE /DUNICODE /DWIN32 /D_WINDOWS -IC:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\hellofxml launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] Start process compile-additional-sources...
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28610.4 for x64
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] Copyright (C) Microsoft Corporation.  All rights reserved.
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] 
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] launcher.c
[Tue Jun 02 18:28:09 EDT 2020][FINE] [SUB] launcher.c(28): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
[Tue Jun 02 18:28:09 EDT 2020][FINE] Result for compile-additional-sources: 2
[Tue Jun 02 18:28:09 EDT 2020][SEVERE] Process compile-additional-sources failed with result: 2
Check the log files under C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/client/ for more information.
[Tue Jun 02 18:28:09 EDT 2020][INFO] Logging process [compile-additional-sources] to file: C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\log\process-compile-additional-sources-1591136889122.log
[Tue Jun 02 18:28:09 EDT 2020][SEVERE] Compiling failed.
Check the log files under C:\Users\Evan\Documents\client-samples\Maven\HelloFXML\target\client\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/client/ for more information.

These are the VS 2019 components I have installed.

java maven javafx visual-studio-2019 graalvm
2个回答
2
投票

我遇到了同样的两个问题:

  1. 不可能进行 cl 操作
  2. stdio.h 或类似文件找不到

第一期的解决方案(作者已经做了):

确保系统路径包含 Visual Studio 条目。类似于“C:\Program Files (x86)\Microsoft Visual Studio�9\Community\VC\Tools\MSVC .25.28610 in\HostX64\x64”之类的东西

Visual Studio 似乎在安装时有时会错过路径变量上的条目。我把它安装到不同的目录。这可能会导致问题。

第二个问题的解决方法:

文档声明如果在 Windows 上运行,您必须在本机工具命令提示符中运行所有 maven 或 gradle 命令。我在阅读文档时错过了那部分几次。

如果您在 Windows 上运行,则需要从 x64 终端运行所有客户端目标。

之后我可以使用客户端:编译和客户端:链接目标。


0
投票

我正在使用 IntelliJ idea。正如 Gluon Documentation 中提到的,“所有构建命令,无论是使用 Maven 还是 Gradle,都必须在名为 x64 Native Tools Command Prompt for VS 2019 的 Visual Studio 2019 命令提示符中执行”。 首先,在 IntelliJ 中找到终端(ALT+f12)。定位到模块的根目录。输入“cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio�9\Community\VC\Auxiliary\Build cvars64.bat”,在我的例子中是“cmd.exe /k "C:\ Program Files (x86)\Microsoft Visual Studio�9\Community\VC\Auxiliary\Build cvars64.bat”。运行。 其次,运行“mvn gluonfx:compile”。 这里是结果。帮助它解决你的问题。

© www.soinside.com 2019 - 2024. All rights reserved.