Gradle / IntelliJ IDEA: sourceCompatibility revert to previous value in IDE settings












3














Setting sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11 has not expected effect in my IntelliJ/Grade/Java project.



Even I set Project SDK and Project Language Level in Project Structure manually to 11, it reverted to 8 and 6 after I Refresh Gradle project (or Import Changes). See below image:



enter image description here





To ensure I created a new project and test these in it. This is its tree view:



enter image description here



The only build.gradle file:



plugins {
id 'java'
}

group 'test'
version '1.0-SNAPSHOT'

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

repositories {
mavenCentral()
}

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}


Gradle version is 4.10.2 as you can see it in gradle-wrapper.properties file:



#Tue Nov 13 00:53:45 IRST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip


And this is environment information:



IntelliJ IDEA 2018.1.5 (Community Edition)
Build #IC-181.5281.24, built on June 12, 2018
JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0


This is an image from my SDKs:



enter image description here





Also, according to this answer, I made below configuration to build.gradle, but the problem persists:



group 'test'
version '1.0-SNAPSHOT'

allprojects {
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

repositories {
...


And also below configuration according to another answer on the same post:



group 'test'
version '1.0-SNAPSHOT'

allprojects {
apply plugin: 'java'

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

repositories {
...









share|improve this question



























    3














    Setting sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11 has not expected effect in my IntelliJ/Grade/Java project.



    Even I set Project SDK and Project Language Level in Project Structure manually to 11, it reverted to 8 and 6 after I Refresh Gradle project (or Import Changes). See below image:



    enter image description here





    To ensure I created a new project and test these in it. This is its tree view:



    enter image description here



    The only build.gradle file:



    plugins {
    id 'java'
    }

    group 'test'
    version '1.0-SNAPSHOT'

    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11

    repositories {
    mavenCentral()
    }

    dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    }


    Gradle version is 4.10.2 as you can see it in gradle-wrapper.properties file:



    #Tue Nov 13 00:53:45 IRST 2018
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip


    And this is environment information:



    IntelliJ IDEA 2018.1.5 (Community Edition)
    Build #IC-181.5281.24, built on June 12, 2018
    JRE: 1.8.0_152-release-1136-b39 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0


    This is an image from my SDKs:



    enter image description here





    Also, according to this answer, I made below configuration to build.gradle, but the problem persists:



    group 'test'
    version '1.0-SNAPSHOT'

    allprojects {
    apply plugin: 'java'
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
    }

    repositories {
    ...


    And also below configuration according to another answer on the same post:



    group 'test'
    version '1.0-SNAPSHOT'

    allprojects {
    apply plugin: 'java'

    tasks.withType(JavaCompile) {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
    }
    }

    repositories {
    ...









    share|improve this question

























      3












      3








      3







      Setting sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11 has not expected effect in my IntelliJ/Grade/Java project.



      Even I set Project SDK and Project Language Level in Project Structure manually to 11, it reverted to 8 and 6 after I Refresh Gradle project (or Import Changes). See below image:



      enter image description here





      To ensure I created a new project and test these in it. This is its tree view:



      enter image description here



      The only build.gradle file:



      plugins {
      id 'java'
      }

      group 'test'
      version '1.0-SNAPSHOT'

      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11

      repositories {
      mavenCentral()
      }

      dependencies {
      testCompile group: 'junit', name: 'junit', version: '4.12'
      }


      Gradle version is 4.10.2 as you can see it in gradle-wrapper.properties file:



      #Tue Nov 13 00:53:45 IRST 2018
      distributionBase=GRADLE_USER_HOME
      distributionPath=wrapper/dists
      zipStoreBase=GRADLE_USER_HOME
      zipStorePath=wrapper/dists
      distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip


      And this is environment information:



      IntelliJ IDEA 2018.1.5 (Community Edition)
      Build #IC-181.5281.24, built on June 12, 2018
      JRE: 1.8.0_152-release-1136-b39 amd64
      JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
      Windows 10 10.0


      This is an image from my SDKs:



      enter image description here





      Also, according to this answer, I made below configuration to build.gradle, but the problem persists:



      group 'test'
      version '1.0-SNAPSHOT'

      allprojects {
      apply plugin: 'java'
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
      }

      repositories {
      ...


      And also below configuration according to another answer on the same post:



      group 'test'
      version '1.0-SNAPSHOT'

      allprojects {
      apply plugin: 'java'

      tasks.withType(JavaCompile) {
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
      }
      }

      repositories {
      ...









      share|improve this question













      Setting sourceCompatibility and targetCompatibility to JavaVersion.VERSION_11 has not expected effect in my IntelliJ/Grade/Java project.



      Even I set Project SDK and Project Language Level in Project Structure manually to 11, it reverted to 8 and 6 after I Refresh Gradle project (or Import Changes). See below image:



      enter image description here





      To ensure I created a new project and test these in it. This is its tree view:



      enter image description here



      The only build.gradle file:



      plugins {
      id 'java'
      }

      group 'test'
      version '1.0-SNAPSHOT'

      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11

      repositories {
      mavenCentral()
      }

      dependencies {
      testCompile group: 'junit', name: 'junit', version: '4.12'
      }


      Gradle version is 4.10.2 as you can see it in gradle-wrapper.properties file:



      #Tue Nov 13 00:53:45 IRST 2018
      distributionBase=GRADLE_USER_HOME
      distributionPath=wrapper/dists
      zipStoreBase=GRADLE_USER_HOME
      zipStorePath=wrapper/dists
      distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip


      And this is environment information:



      IntelliJ IDEA 2018.1.5 (Community Edition)
      Build #IC-181.5281.24, built on June 12, 2018
      JRE: 1.8.0_152-release-1136-b39 amd64
      JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
      Windows 10 10.0


      This is an image from my SDKs:



      enter image description here





      Also, according to this answer, I made below configuration to build.gradle, but the problem persists:



      group 'test'
      version '1.0-SNAPSHOT'

      allprojects {
      apply plugin: 'java'
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
      }

      repositories {
      ...


      And also below configuration according to another answer on the same post:



      group 'test'
      version '1.0-SNAPSHOT'

      allprojects {
      apply plugin: 'java'

      tasks.withType(JavaCompile) {
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
      }
      }

      repositories {
      ...






      gradle intellij-idea java-8 java-11 source-compatibility






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 '18 at 6:31









      Mir-Ismaili

      1,9371434




      1,9371434
























          1 Answer
          1






          active

          oldest

          votes


















          2














          For such issues compatibility of tools matter, you can upgrade your IDE version to a version >= 2018.2.



          Quoting a JetBrains blog #Java11 in IntelliJ IDEA 2018.2




          The next version of Java is due out in September, and IntelliJ IDEA 2018.2 is ready for it.







          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441617%2fgradle-intellij-idea-sourcecompatibility-revert-to-previous-value-in-ide-sett%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            For such issues compatibility of tools matter, you can upgrade your IDE version to a version >= 2018.2.



            Quoting a JetBrains blog #Java11 in IntelliJ IDEA 2018.2




            The next version of Java is due out in September, and IntelliJ IDEA 2018.2 is ready for it.







            share|improve this answer


























              2














              For such issues compatibility of tools matter, you can upgrade your IDE version to a version >= 2018.2.



              Quoting a JetBrains blog #Java11 in IntelliJ IDEA 2018.2




              The next version of Java is due out in September, and IntelliJ IDEA 2018.2 is ready for it.







              share|improve this answer
























                2












                2








                2






                For such issues compatibility of tools matter, you can upgrade your IDE version to a version >= 2018.2.



                Quoting a JetBrains blog #Java11 in IntelliJ IDEA 2018.2




                The next version of Java is due out in September, and IntelliJ IDEA 2018.2 is ready for it.







                share|improve this answer












                For such issues compatibility of tools matter, you can upgrade your IDE version to a version >= 2018.2.



                Quoting a JetBrains blog #Java11 in IntelliJ IDEA 2018.2




                The next version of Java is due out in September, and IntelliJ IDEA 2018.2 is ready for it.








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 18 '18 at 1:13









                nullpointer

                42.8k1091175




                42.8k1091175






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441617%2fgradle-intellij-idea-sourcecompatibility-revert-to-previous-value-in-ide-sett%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    What visual should I use to simply compare current year value vs last year in Power BI desktop

                    Alexandru Averescu

                    Trompette piccolo