Auto Reset language Level 5 with Java complier 1.5

Source: Internet
Author: User

Intellij idea new Maven project, always default language level 5 and Java Compiler 1.5.

Here are two ways to modify:

1. Manual modification:

    •   Java Compiler 1.5

Error:Error:java:Compilation failed:internal java compiler Error

    How to resolve: Target bytecode Version = 1.8, Java Compiler, File--Settings

    •   Language Level 5

Error:Error:java: lambda expression is not supported in-source 1.5 (use-source 8 or later to enable lambda expression)

    Workaround: File, Project Structure, Language level:8-lambdas,type annotations etc.

    • Manual modification Defects: Language Level 5 and Java Compiler 1.5 are automatically reset each time the MAVEN project's Pom.xml is updated.

2. Use the plugin to automatically modify:

Add the plugin under the <build> tab under the Pom.xml of the MAVEN project, and modify the language level and Java compiler to the specified version (this example specifies 8).

  <Build>    <Plugins>      <plugin>        <groupId>Org.apache.maven.plugins</groupId>        <Artifactid>Maven-compiler-plugin</Artifactid>        <version>3.7.0</version>        <Configuration>          <!--Modify language level -          <Source>8</Source>          <!--Modify Java Compiler -          <Target>8</Target>        </Configuration>      </plugin>    </Plugins>  </Build></Project>

 

Auto Reset language Level 5 with Java complier 1.5

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.