Gluon client maven plugin for JavaFX on Windows无法编译?

bfnvny8b  于 2023-04-19  发布在  Java
关注(0)|答案(2)|浏览(129)

我一直在Windows机器上为我的一个项目试验Gluon的客户端maven插件。我决定尝试他们的“hello world”示例之一,here.我遵循了如何配置机器的所有步骤。
然而,我遇到了一些错误。由于某种原因,编译总是失败,并给我一个错误“无法运行程序“cl””。有没有人知道如何解决这个问题?
我正在“x64 Native Tools Command Prompt for VS 2019”窗口中运行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\2019\Community\VC\Tools\MSVC\14.25.28610\bin\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.

toiithl6

toiithl61#

我也有同样的两个问题:
1.无法执行cl操作
1.找不到stdio.h或类似文件

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

确保系统路径包含Visual Studio条目。类似于“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64”

  • Visual Studio在安装时似乎有时会丢失路径变量上的条目。我将其安装到不同的目录。这可能会导致问题。*

第二个问题解决方案:

文档指出,如果在Windows上运行,必须在Native Tools命令提示符中运行所有maven或gradle命令。我在阅读文档时错过了几次这一部分。
如果您在Windows上运行,则需要从x64终端运行所有客户端目标。
在此之后,我可以使用客户端:编译和客户端:链接目标。

pod7payv

pod7payv2#

我使用IntelliJ的想法。正如Gluon文档中提到的,“所有构建命令,无论是Maven还是Gradle,都必须在Visual Studio 2019命令提示符中执行,称为x64 Native Tools Command Prompt for VS 2019”。首先,在IntelliJ中找到终端(ALT+f12)。定位到模块的根目录。键入“cmd. exe/k“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat”,在我的情况下是“cmd. exe/k“C:\Program Files(x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat”。运行它。其次,运行“mvn gluonfx:compile”. Here是结果。希望它能解决你的问题。

相关问题