Ubuntu 版本的 Jenkins 安裝 Java 11 Graalvm 筆記
最近自己的 一些 project, 剛好要用java11 才能compile, 但是用Jenkins內建安裝只能到Java9
,索性就安裝Graalvm,
發現問題
springboot 要打包docker 就發生以下的錯誤
/var/lib/jenkins/workspace/BZK
Removing network bzk_default
Network bzk_default not found.
Error: No such image: net.bzk/bzkflow
[Gradle] - Launching build.
[bzkflow] $ /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/Gradle6.4/bin/gradle clean dockerClean docker
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :bzkflow:clean UP-TO-DATE
> Task :bzkflow:dockerClean UP-TO-DATE
> Task :Comm:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':Comm:compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 4s
3 actionable tasks: 1 executed, 2 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
Java SE 11’ using tool chain: 'JDK 8 (1.8) 只能升級了 QQ
ubutu安裝 graalvm
- 先去 官方最新版 複製最新的版本下載
- 到 ubuntu console :
cd /usr/lib/jvm/
sudo wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.1.0/graalvm-ce-java11-linux-amd64-20.1.0.tar.gz
NOTE : 記得連結可以換最新版本
- 解壓至此
tar -xvzf graalvm-ce-java11-linux-amd64-20.1.0.tar.gz
Jenkins 設定JDK
- 先到 Global Tool Configuration
- 點開
JDK...
選項 - 新增JDK,並輸入內容
名稱 : {自行設定 for ex: GRAALVM_java11 }
JAVA_HOME : /usr/lib/jvm/graalvm-ce-java11-20.1.0/ /*記得換成剛才安裝的版本*/
自動安裝 : false
- 存檔Save
編輯Job就可以選擇 Graalvm了
收工~
md code:
留言
張貼留言