The compilation environment becomes jdk1.5 after you run the Maven pom.xml file

Source: Internet
Author: User

After running the Pom.xml file in idea, the compilation environment becomes 1.5, resulting in a series of compilation problems that are inconvenient.

Here's how to fix it:

Add the following code to the "Pom.xml":
<properties>    <maven.compiler.source>1.8</maven.compiler.source>    <maven.compiler.target>1.8</maven.compiler.target></properties>
Then press "Ctrl+shift+alt+s" to open the project configuration and set the language level of modules to "8".
Finally press "Ctrl+alt+s" to open the settings, search "Java compiler", the default JDK and the current modual JDK version to switch to 1.8. You can also fundamentally resolve the problem by modifying Maven's settings file to add the following to the <profiles> tag:

<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>

The compilation environment becomes jdk1.5 after you run the Maven pom.xml file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.