In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article analyzes "how to change the default JDK version of maven". The content is detailed and easy to understand, and friends who are interested in "how to modify the default JDK version of maven" can follow the editor's train of thought to read it in depth. I hope it will be helpful to everyone after reading. Let's learn more about "how to modify the default JDK version of maven" with the editor.
Modify the default JDK version of maven
In peacetime development, after adding a new java maven project, the default jdk version is java1.5.
The java1.5 version is lower, and there are many new features that report syntax errors after java1.5, such as @ Override compilation failed.
Now let's change the default jdk version of maven. There are two methods.
First: modify the conf/settings.xml under the maven directory, which applies globally.
This method works for all maven projects
Add the following to the profiles node:
Jdk-1.7 true 1.7 1.7 1.7
The JDK version here can be modified at will. It can be jdk1.8 or jdk1.9.
Save after modification and update the maven project:
At this point:
The jdk version has been changed to 1.7.
Second: modify the pom.xml file of the maven project
Add under the node:
Org.apache.maven.plugins maven-compiler-plugin1.71.7 ${file_encoding}
Example:
Then execute (mvn clean, mvn package) with the maven command line to get the jar package compiled with the specified jdk version.
Modify the JDK version of the maven project-compile compile and runtime build path
New java SE projects created with maven will use version 1.5 of JDK by default and will also be compiled to 1.5. If the project manually modifies the configuration of the following two places in eclipse, such as 1.7, it will become 1.5 again each time maven-update project.
Solution
Find the maven configuration file currently used by eclipse, open the configuration file, and add the following code to the profiles node, so right-click the project to execute maven-update project, and the above two running and compilation environments will become 1.7, no more worries.
Jdk-1.7 true 1.7 1.7 1.7
On how to modify the default JDK version of maven to share here, I hope that the above content can make you improve. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following the website!
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: 0
*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.