「之岙」

「之岙」

Maven Packaging Issue

Error Summary#

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

Troubleshooting#

Execute in the terminal

mvn -v

Pay attention to the Java version and runtime in the output, make sure they correspond to the Java version used in the project
If they do not match, it indicates an issue with the environment variables, continue reading below

Check Environment Variables#

Execute in the terminal

java -version
javac -version

The mvn -v command follows the system-level Java environment variables, so these two terminal commands will not correspond to the project

Update Environment Variables#

I encountered this issue on Windows, below is the solution for Windows systems
Windows: Control Panel -> System and Security -> System -> Advanced system settings -> Environment Variables
Here you will see user variables and system variables, I modified both
Select Path in the user variables -> Edit -> New -> Paste the bin path of the corresponding JDK -> Move it to the top
The operations for system variables and user variables are the same
The most important step in solving the issue is to move the bin path of the JDK to the top, as other environment variables may also have Java, which takes over java_home, so moving it to the top resolves the issue

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.