无法在 OS X Catalina 中使用 GRAALVM 生成原生图像
Cannot generate native image using GRAALVM in OS X Catalina
我无法运行 Catalina 10.15.2 中的命令:
bash-3.2$ $GRAALVM_HOME/Home/bin/gu install native-image
它 returns 我这条消息:
cannot be opened because the developer cannot be verified.
我试过了运行宁
sudo xattr -r -d com.apple.quarantine $GRAALVM_HOME
哪里
bash-3.2$ echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents
运气不好。我无法 运行 命令,所以我无法 运行 成功地执行命令
mvn install -Pnative
.
[pastebin][1]
我已经读过这个[线程][2],但对我没用。
求助
更新
好的,我已经采纳了建议,现在我可以创建原生图像了,但是当我尝试 运行 mvn install -Pnative 时,我遇到了一个错误:
~/g/q/quarkus-echo> echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
aironman@MacBook-Pro-de-Alonso ~/g/q/quarkus-echo> cd $GRAALVM_HOME
aironman@MacBook-Pro-de-Alonso /L/J/J/graalvm-ce-java8-19.3.0> sudo xattr -r -d com.apple.quarantine $GRAALVM_HOME
Password:
bash-3.2$ /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/bin/gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image from github.com
Installing new component: Native Image (org.graalvm.native-image, version 19.3.0)
bash-3.2$ pwd
/Users/aironman/gitProjects/quarkus-test/quarkus-echo
bash-3.2$ mvn install -Pnative
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< ujr.combat.quarkus:quarkus-echo >-------------------
[INFO] Building quarkus-echo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-echo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-echo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ quarkus-echo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/aironman/gitProjects/quarkus-test/quarkus-echo/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ quarkus-echo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ quarkus-echo ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running ujr.combat.quarkus.EchoResourceTest
2020-01-13 17:13:45,816 INFO [io.quarkus] (main) Quarkus 1.1.1.Final started in 0.324s. Listening on: http://0.0.0.0:8081
2020-01-13 17:13:45,829 INFO [io.quarkus] (main) Profile test activated.
2020-01-13 17:13:45,829 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.998 s - in ujr.combat.quarkus.EchoResourceTest
2020-01-13 17:13:46,604 INFO [io.quarkus] (main) Quarkus stopped in 0.028s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ quarkus-echo ---
[INFO]
[INFO] --- quarkus-maven-plugin:1.1.1.Final:build (default) @ quarkus-echo ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/aironman/gitProjects/quarkus-test/quarkus-echo/target/quarkus-echo-1.0-SNAPSHOT-native-image-source-jar/quarkus-echo-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/aironman/gitProjects/quarkus-test/quarkus-echo/target/quarkus-echo-1.0-SNAPSHOT-native-image-source-jar/quarkus-echo-1.0-SNAPSHOT-runner.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.070 s
[INFO] Finished at: 2020-01-13T17:13:48+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.1.Final:build (default) on project quarkus-echo: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.getNativeImageExecutable(NativeImageBuildStep.java:376)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:134)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR] at io.quarkus.deployment.ExtensionLoader.execute(ExtensionLoader.java:915)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:830)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] -> [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
bash-3.2$ echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
bash-3.2$
更新 2
根据 Viktor 的建议,我更改了 GRAALVM_HOME:
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home
bash-3.2$ export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home
bash-3.2$ /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/bin/gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Component Native Image (org.graalvm.native-image) is already installed.
bash-3.2$ pwd
/Users/aironman/gitProjects/quarkus-test/quarkus-echo
bash-3.2$ mvn install -Pnative
...
project quarkus-echo: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.IllegalStateException: Unsupported version of GraalVM detected: GraalVM Version 19.3.0 CE. Please use GraalVM 19.2.1.
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.checkGraalVMVersion(NativeImageBuildStep.java:340)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:155)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR] at io.quarkus.deployment.ExtensionLoader.execute(ExtensionLoader.java:915)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:830)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] -> [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
看来我必须降级到 GRAALVM 19.2.1...
谢谢大家的帮助。我将了解如何使用 brew 降级到所需版本...
您需要运行 删除 topdir 上的隔离区:
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
这在 10 分钟前对我有用 OSX 0.14.6 Mojave
也有同样的问题
安装 GRAALVM
brew install --cask graalvm/tap/graalvm-ce-java11
# check your version and fix the last part of path
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0
# install native image
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home/bin/gu install native-image
导出GRAALVM_HOME~/.bash_profile
# don't forget to fix version of GraalVM, yours can be newer
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home
使用 GRAALVM 构建
./gradlew build -Dquarkus.package.type=native
为 OSX BigSur 工作!
按以下顺序执行以下命令
brew install --cask graalvm/tap/graalvm-ce-lts-java11
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home
/Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home/bin/gu install native-image
在~/.zshrc中添加如下内容
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home
export PATH=$PATH:$GRAALVM_HOME
source ~/.zshrc
使用 mvn 或 gradle
构建
mvn package -Dquarkus.package.type=native
或
./gradlew build -Dquarkus.package.type=native
我无法运行 Catalina 10.15.2 中的命令:
bash-3.2$ $GRAALVM_HOME/Home/bin/gu install native-image
它 returns 我这条消息:
cannot be opened because the developer cannot be verified.
我试过了运行宁
sudo xattr -r -d com.apple.quarantine $GRAALVM_HOME
哪里
bash-3.2$ echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents
运气不好。我无法 运行 命令,所以我无法 运行 成功地执行命令
mvn install -Pnative
.
[pastebin][1]
我已经读过这个[线程][2],但对我没用。
求助
更新
好的,我已经采纳了建议,现在我可以创建原生图像了,但是当我尝试 运行 mvn install -Pnative 时,我遇到了一个错误:
~/g/q/quarkus-echo> echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
aironman@MacBook-Pro-de-Alonso ~/g/q/quarkus-echo> cd $GRAALVM_HOME
aironman@MacBook-Pro-de-Alonso /L/J/J/graalvm-ce-java8-19.3.0> sudo xattr -r -d com.apple.quarantine $GRAALVM_HOME
Password:
bash-3.2$ /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/bin/gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image from github.com
Installing new component: Native Image (org.graalvm.native-image, version 19.3.0)
bash-3.2$ pwd
/Users/aironman/gitProjects/quarkus-test/quarkus-echo
bash-3.2$ mvn install -Pnative
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< ujr.combat.quarkus:quarkus-echo >-------------------
[INFO] Building quarkus-echo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-echo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quarkus-echo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ quarkus-echo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/aironman/gitProjects/quarkus-test/quarkus-echo/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ quarkus-echo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ quarkus-echo ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running ujr.combat.quarkus.EchoResourceTest
2020-01-13 17:13:45,816 INFO [io.quarkus] (main) Quarkus 1.1.1.Final started in 0.324s. Listening on: http://0.0.0.0:8081
2020-01-13 17:13:45,829 INFO [io.quarkus] (main) Profile test activated.
2020-01-13 17:13:45,829 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.998 s - in ujr.combat.quarkus.EchoResourceTest
2020-01-13 17:13:46,604 INFO [io.quarkus] (main) Quarkus stopped in 0.028s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ quarkus-echo ---
[INFO]
[INFO] --- quarkus-maven-plugin:1.1.1.Final:build (default) @ quarkus-echo ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/aironman/gitProjects/quarkus-test/quarkus-echo/target/quarkus-echo-1.0-SNAPSHOT-native-image-source-jar/quarkus-echo-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/aironman/gitProjects/quarkus-test/quarkus-echo/target/quarkus-echo-1.0-SNAPSHOT-native-image-source-jar/quarkus-echo-1.0-SNAPSHOT-runner.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.070 s
[INFO] Finished at: 2020-01-13T17:13:48+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.1.Final:build (default) on project quarkus-echo: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.getNativeImageExecutable(NativeImageBuildStep.java:376)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:134)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR] at io.quarkus.deployment.ExtensionLoader.execute(ExtensionLoader.java:915)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:830)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] -> [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
bash-3.2$ echo $GRAALVM_HOME
/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
bash-3.2$
更新 2
根据 Viktor 的建议,我更改了 GRAALVM_HOME:
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home
bash-3.2$ export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home
bash-3.2$ /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/bin/gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Component Native Image (org.graalvm.native-image) is already installed.
bash-3.2$ pwd
/Users/aironman/gitProjects/quarkus-test/quarkus-echo
bash-3.2$ mvn install -Pnative
...
project quarkus-echo: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.IllegalStateException: Unsupported version of GraalVM detected: GraalVM Version 19.3.0 CE. Please use GraalVM 19.2.1.
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.checkGraalVMVersion(NativeImageBuildStep.java:340)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:155)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR] at io.quarkus.deployment.ExtensionLoader.execute(ExtensionLoader.java:915)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:830)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] -> [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
看来我必须降级到 GRAALVM 19.2.1...
谢谢大家的帮助。我将了解如何使用 brew 降级到所需版本...
您需要运行 删除 topdir 上的隔离区:
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0
这在 10 分钟前对我有用 OSX 0.14.6 Mojave
安装 GRAALVM
brew install --cask graalvm/tap/graalvm-ce-java11
# check your version and fix the last part of path
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0
# install native image
/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home/bin/gu install native-image
导出GRAALVM_HOME~/.bash_profile
# don't forget to fix version of GraalVM, yours can be newer
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-20.3.0/Contents/Home
使用 GRAALVM 构建
./gradlew build -Dquarkus.package.type=native
为 OSX BigSur 工作!
按以下顺序执行以下命令
brew install --cask graalvm/tap/graalvm-ce-lts-java11
sudo xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home
/Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home/bin/gu install native-image
在~/.zshrc中添加如下内容
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-lts-java11/Contents/Home
export PATH=$PATH:$GRAALVM_HOME
source ~/.zshrc
使用 mvn 或 gradle
构建mvn package -Dquarkus.package.type=native
或
./gradlew build -Dquarkus.package.type=native