首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mvn -Pandroid gluonfx:构建无法定位Graalvm安装目录

mvn -Pandroid gluonfx:构建无法定位Graalvm安装目录
EN

Stack Overflow用户
提问于 2021-09-16 21:10:03
回答 2查看 161关注 0票数 0

我希望这不是一个与滥用环境变量有关的简单错误!

编辑:是的,就是这样发生的。我想我可以删除整个问题,以免妨碍其他胶子/Graavlm问题的主题。

用于创建Android构建的胶子文档让我们执行以下命令:

代码语言:javascript
复制
mvn -Pandroid gluonfx:build

我是在我的Ubuntu20.04系统上执行这一操作的,该系统是从文档中引用的下载的"HelloFX“项目中执行的。

代码语言:javascript
复制
phil@UbuntuDesktop:~/Projects/metronome/gluon-samples-master/HelloFX$ echo $GRAALVM_HOME
/usr/lib/graalvm-svn-linux-gluon-21.2.0-dev
phil@UbuntuDesktop:~/Projects/metronome/gluon-samples-master/HelloFX$ sudo mvn -Pandroid gluonfx:build
[sudo] password for phil: 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.gluonhq.samples:hellofx >---------------------
[INFO] Building HelloFX 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.5:build (default-cli) @ hellofx ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.gluonhq.samples:hellofx >---------------------
[INFO] Building HelloFX 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> gluonfx-maven-plugin:1.0.5:compile (default-cli) > process-classes @ hellofx >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hellofx ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< gluonfx-maven-plugin:1.0.5:compile (default-cli) < process-classes @ hellofx <<<
[INFO] 
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.5:compile (default-cli) @ hellofx ---
org.apache.maven.plugin.MojoExecutionException: GraalVM installation directory not found. Either set GRAALVM_HOME as an environment variable or set graalvmHome in gluonfx-plugin configuration
    at com.gluonhq.NativeBaseMojo.createSubstrateDispatcher(NativeBaseMojo.java:147)
    at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:53)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[INFO] ------------------------------------------------------------------------
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[INFO] BUILD FAILURE

控制台输出还有更多内容。如有要求,我会把这个包括在内。

我认为这里的关键是:

找不到org.apache.maven.plugin.MojoExecutionException: GraalVM安装目录。将GRAALVM_HOME设置为环境变量或将graalvmHome设置为gluonfx-plugin配置。

下面是GRAALVM_HOME引用的文件夹中文件的列表。这些是从胶子文档中列出的Graalvm版本中解压出来的。

代码语言:javascript
复制
phil@UbuntuDesktop:~/Projects/metronome/gluon-samples-master/HelloFX$ cd $GRAALVM_HOME
phil@UbuntuDesktop:/usr/lib/graalvm-svn-linux-gluon-21.2.0-dev$ ls -al
total 388
drwxr-xr-x   9 root root   4096 Sep 13 16:43 .
drwxr-xr-x 135 root root  12288 Sep 13 19:04 ..
-rw-r--r--   1 root root  29628 Sep 13 16:43 3rd_party_license_llvm-toolchain.txt
drwxr-xr-x   2 root root   4096 Sep 13 16:43 bin
drwxr-xr-x   4 root root   4096 Sep 13 16:43 conf
-rw-r--r--   1 root root   2316 Sep 13 16:43 GRAALVM-README.md
drwxr-xr-x   3 root root   4096 Sep 13 16:43 include
drwxr-xr-x   2 root root   4096 Sep 13 16:43 jmods
drwxr-xr-x   3 root root   4096 Sep 13 16:43 languages
drwxr-xr-x  72 root root   4096 Sep 13 16:43 legal
drwxr-xr-x  16 root root   4096 Sep 13 16:43 lib
-rw-r--r--   1 root root  21035 Sep 13 16:43 LICENSE_NATIVEIMAGE.txt
-rw-r--r--   1 root root  27235 Sep 13 16:43 LICENSE.txt
-rw-r--r--   1 root root   2766 Sep 13 16:43 release
-rw-r--r--   1 root root 257599 Sep 13 16:43 THIRD_PARTY_LICENSE.txt

可能出什么问题了?也许环境变量被“gluonfx-plugin配置中的graalvmHome”覆盖了?这不是指项目的pom.xlm吗?在android的相关maven配置文件中,我没有看到任何东西。

代码语言:javascript
复制
        <plugin>
            <groupId>com.gluonhq</groupId>
            <artifactId>gluonfx-maven-plugin</artifactId>
            <version>${gluonfx.maven.plugin.version}</version>
            <configuration>
                 <target>${gluonfx.target}</target>
                 <mainClass>${main.class}</mainClass>
            </configuration>
        </plugin>

从简介中:

代码语言:javascript
复制
    <profile>
        <id>android</id>
        <properties>
            <gluonfx.target>android</gluonfx.target>
        </properties>
    </profile>

在这一过程中,可能会有更多的问题。我担心文档中提到了安卓和谷歌安装m2Repositories的“附加”要求,但据我所知,我最近安装的Android并没有在SDK,SDK工具中提供这些。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-09-16 22:09:38

@Jose发现的答案:使用sudo使我们脱离了声明环境变量的用户环境。

票数 0
EN

Stack Overflow用户

发布于 2022-07-16 16:29:52

下载=> https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-22.1.0并在系统名为GRAALVM_HOME和path中创建新的环境变量.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69215202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档