title: How to setup a Gradle plugin project in IntelliJ?
body: <p>I want to create a standalone Gradle plugin project as described in the <a href="https://gradle.org/docs/current/userguide/custom_plugins.html" rel="noreferrer">Gradle documentation</a>. I would like to use <a href="https://www.jetbrains.com/idea/" rel="noreferrer">IntelliJ</a> with code completion for <a href="http://groovy.codehaus.org" rel="noreferrer">Groovy</a> and <a href="https://gradle.org" rel="noreferrer">Gradle</a>. Since there is no specialized wizard to create a Gradle plugin project I have to do it manually.<br>
  I already managed to add the <a href="http://groovy.codehaus.org/Download" rel="noreferrer">Groovy SDK (binary)</a> in the IDE via: <em>File / Other Settings / Default Project Structure</em> as shown in the screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/rPd1J.png" alt="IntelliJ / Project Structure"></p>
  
  <p>To start with I created a new Gradle project which also contains the Gradle wrapper. I then create a Groovy script named <code>MyExamplePlugin.groovy</code> following the project structure of the <a href="https://github.com/JakeWharton/sdk-manager-plugin/blob/0.12.0/src/main/groovy/com/jakewharton/sdkmanager/SdkManagerPlugin.groovy#L15" rel="noreferrer">sdk-manager-plugin</a>; please note me if this project does not follow the desired setup.</p>
  
  <pre><code>.
  ├── MyExamplePlugin.iml
  ├── build.gradle
  ├── gradle
  │   └── wrapper
  │       ├── gradle-wrapper.jar
  │       └── gradle-wrapper.properties
  ├── gradlew
  ├── gradlew.bat
  ├── plugin
  │   └── src
  │       └── main
  │           ├── groovy
  │           │   └── com
  │           │       └── example
  │           │           └── MyExamplePlugin.groovy
  │           └── resources
  │               └── META-INF
  │                   └── gradle-plugins
  │                       └── myexample.properties
  └── settings.gradle
  </code></pre>
  
  <p>Then I start implementing the class:</p>
  
  <pre><code>import org.gradle.api.Plugin
  import org.gradle.api.Project
  
  class MyExamplePlugin implements Plugin&lt;Project&gt; {
     // ...
  }
  </code></pre>
  
  <p>The problem is that <code>org.gradle.api.*</code> cannot be found.</p>