title: Gradle / IntelliJ IDEA: sourceCompatibility reverts to previous value in IDE settings
body: <p>Setting <code>sourceCompatibility</code> and <code>targetCompatibility</code> to <code>JavaVersion.VERSION_11</code> has not expected effect in my IntelliJ/Grade/Java project. </p>
  
  <p>Even I set <em>Project SDK</em> and <em>Project Language Level</em> in <strong>Project Structure</strong> manually to 11, it reverted to 8 and 6 after I  <strong>Refresh Gradle project</strong> (or <strong>Import Changes</strong>). See below image:</p>
  
  <p><a href="https://i.stack.imgur.com/HRS2w.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HRS2w.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>To ensure I created a <strong>new project</strong> and test these in it. This is its tree view:</p>
  
  <p><a href="https://i.stack.imgur.com/uTyOP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uTyOP.png" alt="enter image description here"></a></p>
  
  <p>The only <strong>build.gradle</strong> file:</p>
  
  <pre><code>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'
  }
  </code></pre>
  
  <p>Gradle version is <code>4.10.2</code> as you can see it in <strong>gradle-wrapper.properties</strong> file:</p>
  
  <pre><code>#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
  </code></pre>
  
  <p>And this is environment information:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>This is an image from my SDKs:</p>
  
  <p><a href="https://i.stack.imgur.com/pusFi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pusFi.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>Also, according to <a href="https://stackoverflow.com/a/24862369/5318303">this answer</a>, I made below configuration to <strong>build.gradle</strong>, but the problem persists:</p>
  
  <pre><code>group 'test'
  version '1.0-SNAPSHOT'
  
  allprojects {
      apply plugin: 'java'
      sourceCompatibility = JavaVersion.VERSION_11
      targetCompatibility = JavaVersion.VERSION_11
  }
  
  repositories {
      ...
  </code></pre>
  
  <p>And also below configuration according to <a href="https://stackoverflow.com/a/21051506/5318303">another answer</a> on the same post:</p>
  
  <pre><code>group 'test'
  version '1.0-SNAPSHOT'
  
  allprojects {
      apply plugin: 'java'
  
      tasks.withType(JavaCompile) {
          sourceCompatibility = JavaVersion.VERSION_11
          targetCompatibility = JavaVersion.VERSION_11
      }
  }
  
  repositories {
      ...
  </code></pre>