Solution to the failure prompt message of maven install and maven build in Eclipse

1. Error message

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
No compiler is provided in this environment. Maybe you are running JRE instead of JDK.
Tell us that maven should run in jdk, and Eclipse runs in jre by default

2. Solution

I installed a jdk1.8 on the E disk by myself, and my Eclipse was only equipped with a local E disk jdk
Insert picture description here
and javaSE-1.x I also configured my E disk jdk
Insert picture description here
butmaven Installwithmaven buildStill failed, still prompted
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK
So I guessed that eclipse might be looking for jdk1.8 in my C drive, and using the jre in it,
Insert picture description here
Insert picture description here
so I added a
new jdk1.8 of C drive in eclipse. New steps: window—preferences—java—Installed JREs—add
Insert picture description here
Browse the directory to find the jdk of my C drive, and then finish
Insert picture description here
adding it as follows.
Insert picture description here
Then click the Installed JREs drop-down button, click Execution Environment, and change javaSE-1.x to the newly added jdk of the C drive.
Insert picture description here
Then update the maven project update Project, and then run maven Install, the package is successful.
However, a new problem appeared during the maven build: I
错误信息Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1
felt that there was a problem with the plug-in. Later, I borrowed the solutions of other bloggers and added the plug-in to pom.xml.

<plugin>  
	<groupId>org.apache.maven.plugins</groupId>  
	<artifactId>maven-compiler-plugin</artifactId>  
	<version>3.1</version>  
	<configuration>  
		<verbose>true</verbose>  
		<fork>true</fork>  
		<executable>C:/Program Files/Java/jdk1.8.0_221/bin/javac</executable>
	</configuration>  
</plugin> 

In which <executable>C:/Program Files/Java/jdk1.8.0_221/bin/javac</executable>the parameters in my C drive the jdk javac path.
Finally, update the maven project update Project, maven build and maven Install are solved perfectly. wink!!!

3. Conclusion

This is my personal configuration solution. If you have a configuration problem in the same situation as mine, you can try it.

4. Read related blog posts

Guess you like

Origin blog.csdn.net/qq_47768542/article/details/108443331