title: Protobuf configuration Intellij Idea Plugin Gradle-kotlin-dsl kotlin
body: <p>Hey I would like to set up protobuf in intellij idea plugin as a client for other protobuf server (written in golang). That will be my first java approach to grpc. I tried to use kotlin classess generator, but i had even less sucess than with this approach.</p>
  
  <p>My goal is:
   Best case scenario: Plugin will allow to compile proto to kt files
   Very OK case scenario: Plugin will output java files to src/main/proto </p>
  
  <p>Existing code structure:</p>
  
  <pre><code>└───src
      ├───main
      │   ├───kotlin
      │   │   └───pl
      │   │       └───dominikw
      │   │           ├───configuration
      │   │           ├───model
      │   │           ├───service
      │   │           │   └───impl
      │   │           └───ui
      │   ├───proto
      │   └───resources
      │       ├───icons
      │       └───META-INF
      └───test
          ├───kotlin
          └───resources
  </code></pre>
  
  <p>And Gradle kotlin dsl file :</p>
  
  <pre><code>import com.google.protobuf.gradle.*
  import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
  
  group = "pl.dominikw"
  version = "0.1.1"
  val protobufVersion = "3.9.1"
  
  buildscript {
      repositories {
          mavenCentral()
          maven("https://oss.sonatype.org/content/repositories/snapshots/")
          maven("https://dl.bintray.com/jetbrains/intellij-plugin-service")
      }
      dependencies {
          classpath("org.jetbrains.intellij.plugins:gradle-intellij-plugin:0.5.0-SNAPSHOT")
      }
  }
  
  plugins {
      id("org.jetbrains.intellij") version "0.4.10"
      id("com.google.protobuf") version "0.8.10"
      kotlin("jvm") version "1.3.50"
      java
      idea
  }
  
  repositories {
      mavenCentral()
      maven("https://dl.bintray.com/kittinunf/maven")
  }
  
  dependencies {
      implementation(kotlin("stdlib-jdk8"))
      implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1")
      implementation("com.github.kittinunf.fuel", "fuel", "2.2.0")
  
      compile("com.google.protobuf:protobuf-java:$protobufVersion")
      compile("io.grpc:grpc-stub:1.15.1")
      compile("io.grpc:grpc-protobuf:1.15.1")
      if (JavaVersion.current().isJava9Compatible) {
          compile("javax.annotation:javax.annotation-api:1.3.2")
      }
  //    protobuf(files("src/main/proto"))
  //    "mainProto"(files("src/main/proto"))
      runtime("io.grpc:grpc-netty:1.14.0")
  }
  
  sourceSets {
      main {
          java.srcDir("src/main/kotlin")
          resources.srcDir("src/main/resources")
          proto.srcDir("src/main/proto")
      }
  }
  
  // See https://github.com/JetBrains/gradle-intellij-plugin/
  intellij {
      version = "2019.2"
  }
  tasks.getByName&lt;org.jetbrains.intellij.tasks.PatchPluginXmlTask&gt;("patchPluginXml") {
      changeNotes(
          """
        Add change notes here.&lt;br&gt;
        &lt;em&gt;most HTML tags may be used&lt;/em&gt;"""
      )
  }
  
  configure&lt;org.jetbrains.intellij.IntelliJPluginExtension&gt; {
      version = "2019.2"
      updateSinceUntilBuild = true
      pluginName = "Windchill-Plugin"
  }
  tasks.withType&lt;KotlinCompile&gt; {
      kotlinOptions.jvmTarget = "1.8"
  }
  
  protobuf {
      protoc {
          artifact = "com.google.protobuf:protoc:$protobufVersion"
      }
      plugins {
          id("grpc") {
              artifact = "io.grpc:protoc-gen-grpc-java:1.15.1"
          }
      }
      generateProtoTasks {
          ofSourceSet("main").forEach {
              it.plugins {
                  id("grpc")
              }
          }
      }
  }
  </code></pre>
  
  <p>And the error code is as follows:</p>
  
  <pre><code>7:17:20 PM: Executing task 'generateProto'...
  
  &gt; Task :extractIncludeProto UP-TO-DATE
  &gt; Task :extractProto UP-TO-DATE
  &gt; Task :generateProto FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':generateProto'.
  &gt; protoc: stdout: . stderr: C:\Users\XXX\IdeaProjects\Windchill-Intellij-Plugin\build\extracted-protos\main\service.proto: Input is shadowed in the --proto_path by "C:/Users/XXX/IdeaProjects/Windchill-Intellij-Plugin/src/main/proto/service.proto".  Either use the latter file as your input or reorder the --proto_path so that the former file's location comes first.
  
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 0s
  3 actionable tasks: 1 executed, 2 up-to-date
  7:17:20 PM: Task execution finished 'generateProto'.
  
  </code></pre>