Wednesday, October 17, 2018

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Error when i do "mvn package"

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I am not using any IDE, i am using my cmd prompt. My java version is 1.8 and maven version is 3.5

Solution:
1. Got to your project folder and find the pom.xml file
2. Find the line having "<artifactId>maven-compiler-plugin</artifactId>"
3. Add the following line (based on your java location path)

<plugin>
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
  <configuration>
<fork>true</fork>
<executable>C:\Program Files\Java\jre1.8.0_181\bin\javacpl.exe</executable>
  </configuration>

 </plugin>

4. Save the pom.xml
5. Run "mvn package", it will work.

No comments:

Post a Comment