I'm getting this error when I try a Jenkins build on a maven project:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
The java and maven plugin are installed automatically, after several research, I couldn't find a solution!
Does anyone have ever face this issue?
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration -> JDK. Provide path to the JDK under JAVA_HOME field.
First make sure the your Job in Jenkins doesn't use the "default Jdk" by going to the job: Press on Configure - > and roll to the JDK section - and make sure you have JDK configure instead of Default.
if you don't have it - go back to Jenkins - > Manage Jenkins -> Configure System - > Jdk and map your Jdk Root for Jenkins.
when you finish that - go back and choose your map JDK - and everything will work.
May be this issue is already resolved by now. But I had the same issue recently and I have the following settings in my Jenkins
. This happened in my Windows 10
Jenkins
installation.
JDK
at C:\\Java\\Jdk8
and made JAVA_HOME
point to this location. Also make sure that PATH env variable has %JAVA_HOME%\\bin.JRE
(which comes bundled with Oracle JDK
installation) at C:\\Program Files\\Java\\JRE
.# javac -version
javac 1.8.0_201
# java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: C:\apache-maven-3.6.0\bin\..
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Java\jdk8\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I believe the change that fixed the problem was the addition of env variables under Manage Jenkins -> Configure System
.
You might not have set JAVA_HOME in Jenkin installed server. Set JAVA_HOME and restart your Jenkin server.
根据您的错误消息,您要么没有安装JDK,要么需要配置 Jenkins 的 CLASSPATH 以指向您的 JDK 安装。
在Jenkins Global Tool配置中给出JDK路径即可,即我们在di中保存jdk文件的路径
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.