Reputation: 4949
My Maven project isn't seeing the compiler -- which is JavaSE-1.8 on Eclipse. the compiler is running fine from everywhere else in Eclipse.
The error I keep getting is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project DNM: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
My pom.xml
is as follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>AxyMVN</groupId>
<artifactId>DNM</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DNM</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
the configuration of the compiler on project seems fine:
on the Project Explorer window, JRE System Library
on the project shows that it is set to JavaSE-1.8
.
the Java Compiler
properties for the project is set to Use compliance from execution environment 'JavaSE-1.8' on the Java Build Path
.
in Run Configurations
window of the project, the one that opens on Right-click > Run as > Run configurations
,
the JRE
tab show that it's set to Workspace default JRE (jre1.8.0_20)
.
adding the following to the <properties>
tag in pom.xml
didn't change anything.
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
I didn't skip Maven > Update Project
everytime I tried out the configuration.
the project isn't showing any other errors anywhere else.
What am I missing?
Note: I saw Maven "build path specifies execution environment J2SE-1.5", even though I changed it to 1.7 among some other discussions.
Upvotes: 1
Views: 1313
Reputation: 4949
Window → Preferences → Java → Installed JREs.
fixed it. it was set to JRE-- set it JDK-- the one my JAVA_HOME
is showing.
Eclipse/Maven error: "No compiler is provided in this environment" helped it.
Upvotes: 0
Reputation: 2094
It is literally saying to you " Perhaps you are running on a JRE rather than a JDK?", which means - Don't run on jre but on jdk. download the jdk version and configure it, good luck
Upvotes: 1