简体   繁体   中英

No compiler is provided in this environment with jenkins

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.

Go To Jenkins -> Manage Jenkins -> Global Tool Configuration.

Now click on "JDK installations.." under JDK

Uncheck Install automatically

Provide path to the JDK under JAVA_HOME field.

Refer:-

在此处输入图片说明

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.

  1. Installed JDK at C:\\Java\\Jdk8 and made JAVA_HOME point to this location. Also make sure that PATH env variable has %JAVA_HOME%\\bin.
  2. Installed JRE (which comes bundled with Oracle JDK installation) at C:\\Program Files\\Java\\JRE .
  3. Jenkins -> Manage Jenkins -> Configure System 在此处输入图片说明

  4. Jenkins -> Manage Jenkins -> Global Tool Configuration 在此处输入图片说明

# 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文件的路径

IF you don't want to add anythig in Global tools Configuration, add new environment variable java.home in the Jenkins slave configuration as maven detects java.home and not JAVA_HOME .

java.home ---> C:\\Java\\jdk1.8.0_181\\jre

在此处输入图片说明

Enter http://localhost:8080/configure. Then go Jenkins Location.

Jenkins Configuration:

在此处输入图片说明

Environment variable configuration:

在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM