In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to solve the corresponding relationship between maven and jdk version, the article is very detailed, has a certain reference value, interested friends must read it!
Corresponding relationship between maven and jdk version
Many partners who move bricks will encounter the following compilation problems when using maven projects to package:
Caused by: java.lang.UnsupportedClassVersionError: org/apache/maven/plugin/compiler/CompilerMojo: Unsupported major.minor version 51.0
At java.lang.ClassLoader.defineClass1 (Native Method)
Looking up the information on the Internet, we found that it was caused by the inconsistency between the maven version and the jdk version.
Solution (windows)
1.mvn-version to view the local maven version
Java-version to view the local jdk version
two。 Click http://maven.apache.org/docs/history.html
Check the correspondence between maven and jdk version
3. Now that it is clear that the problem of ensuring that the local maven is consistent with the jdk is gone, rebuild the packaged ok.
Maven and java have different jdk versions
JDK14 has been added, and the environment variables are configured as follows (the previous 8 is also reserved for switching)
Then, I queried the version of jdk because I wanted to use maven, and by the way, I also queried the version of maven. Look, the two versions of JAVA are different.
How do you change it to the same?
1. JDK is the 14 you currently want to set, and there is nothing wrong with it.
two。 Check the configuration of maven, maven/config/setting.xml
That's all you need to search for JDK, and it's been commented out. Forget it. Pretend he doesn't exist.
3. Take a look at maven's running script (mvn.cmd)
Search JAVA, hehe, JAVA_HOME, what is my java_home? If you look at my environment variable (figure 1), java_home is 1.8.
Come on, change the name, the picture has the truth [remember to change the PATH environment variable reference, remember to change the PATH environment variable reference, remember to change the PATH environment variable reference (JAVA14_HOME to JAVA_HOME)]
After saving, open a cmd window, and the result comes.
Note: the environment variable name of Java is best set to JAVA_HOME. If there are multiple jdk versions, only the version you want to use is set, not all of them in the environment variable. If you want to change the version, you can directly modify the directory corresponding to java_home.
The above is all the contents of this article entitled "how to solve the problem of correspondence between maven and jdk versions". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 277
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.