How to change project language level for all project in Intellij

后端 未结 7 1784
Happy的楠姐
Happy的楠姐 2020-12-15 04:33

I am using Intellij. It is good, but when I create a new project or import a project the default project language level set to 6 (@override in interfaces). But I want to set

相关标签:
7条回答
  • 2020-12-15 04:58

    I changed the settings to Java 8 as advised above...->Default Project Structure.

    It did'nt work!!

    I continued not being able to write Lambda's in the editor without errors.

    When I created the project, I chose Gradle as the build tool. For some reason my Java/Gradle project had the source compatibility in the build.gradle file set to 1.5 (maybe because my default was originally set to 1.5...I don't know as I did not bother to reproduce it):

    apply plugin: 'java'
    
    sourceCompatibility = 1.5
    
    repositories {
        mavenCentral()
    }
    

    Changing the sourceCompatibility to 1.8 solved the problem, since the update to the gradle file also triggers a project build.

    Word to the wise:

    any newbie on Intelij should remember that not selecting either Maven or Gradle in conjunction with your Java project creation will not setup the default package (src/main/test and src/main/java) structures necessary; for eclipse users this is a real head scratcher when first starting to use Intelij.

    0 讨论(0)
提交回复
热议问题