title: Gradle kotlin script, > Plugin with id `kotlin` not found
body: <p>I tried to migrate one of my <a href="https://github.com/elect86/kotlin-unsigned" rel="nofollow noreferrer">project</a> to Gradle using a Kotlin script.</p>
  <p>These are my steps:</p>
  <ul>
  <li>substituted the <code>/gradle/wrapper/gradle-wrapper.jar</code> with <a href="https://github.com/gradle/gradle-script-kotlin/blob/master/samples/hello-kotlin/gradle/wrapper/gradle-wrapper.jar" rel="nofollow noreferrer">this one</a></li>
  <li>updated the <code>distributionUrl</code> of <code>gradle/wrapper/gradle-wrapper.properties</code> to the same as <a href="https://github.com/gradle/gradle-script-kotlin/blob/master/samples/hello-kotlin/gradle/wrapper/gradle-wrapper.properties#L5" rel="nofollow noreferrer">here</a></li>
  <li>created the corresponding <a href="https://github.com/elect86/kotlin-unsigned/blob/master/build.gradle.kts" rel="nofollow noreferrer"><code>build.gradle.kts</code></a></li>
  <li>setting <code>settings.gradle</code> to <code>rootProject.buildFileName = 'build.gradle.kts'</code></li>
  </ul>
  <p>At that point Intellij detects it and suggests:</p>
  <blockquote>
  <p>You can configure Gradle wrapper to use distribution with sources. It will provide IDE with Gradle API/DSL documentation.</p>
  </blockquote>
  <p>-&gt; Ok, apply suggestion!</p>
  <blockquote>
  <p>Gradle 'hello-kotlin' project refresh failed</p>
  <p>Error:Plugin with id 'kotlin' not found.</p>
  </blockquote>
  <p>Then I also tried to try one of the official <a href="https://github.com/gradle/gradle-script-kotlin/tree/master/samples/hello-kotlin" rel="nofollow noreferrer">samples</a>:</p>
  <ul>
  <li>cloned the repo</li>
  <li>opened the sample</li>
  <li>same error</li>
  </ul>
  <p>...what am I doing wrong?</p>
  <p>I came back to the official sample, tried to invalidate cache and restart, it didn't work</p>
  <p>I tried to remove</p>
  <pre><code>apply {
      plugin(&quot;kotlin&quot;)
  }
  </code></pre>
  <p>Refresh Gradle, add it again, refresh Gradle, it worked</p>
  <p>If I open a src file, Intellij says:</p>
  <blockquote>
  <p>Kotlin not configured</p>
  </blockquote>
  <p>However the sample seems running now..</p>
  <p>Intellij 2017.1 EAP</p>
  <p>Kotlin 1.1m04</p>