Reputation: 581
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?
Upvotes: 19
Views: 41609
Reputation: 11
You might not have set JAVA_HOME in Jenkin installed server. Set JAVA_HOME and restart your Jenkin server.
Upvotes: 1
Reputation: 182
Enter http://localhost:8080/configure. Then go Jenkins Location.
Jenkins Configuration:
Environment variable configuration:
Upvotes: 2
Reputation: 1479
Go To Jenkins -> Manage Jenkins -> Global Tool Configuration -> JDK. Provide path to the JDK under JAVA_HOME field.
Upvotes: 21
Reputation: 1748
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
Upvotes: 0
Reputation: 6114
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
.
Upvotes: 4
Reputation: 11
Just give the JDK path in Jenkins Global Tool configurations, i.e the path where we have kept the jdk file in the di
Upvotes: 0
Reputation: 17593
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:-
Upvotes: 6
Reputation: 111
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.
Upvotes: 10
Reputation: 18226
According to your error message you either do not have a JDK installed or you need to configure Jenkins's CLASSPATH to point to your JDK installation.
Upvotes: 0