Intellij IDEA confused by protobuf gradle subproject?
Hey,
I'm trying to use googles protobuf plugin for gradle to automate building the jar file and using the generated source in another subproject. Unfortunatly intellj dosen't seem to understand where to find those sources and can't resolve the symbol. My fix for right now was adding a bit of extra stuff to the build.gradle for the protobuf subproject:
compileJava {
dependsOn 'makeItCompile'
}
compileJava.finalizedBy 'intelljFix'
task makeItCompile {
delete "./src/main/java"
}
task intelljFix(type: Copy) {
from "./build/generated/source/proto/main/java"
into "./src/main/java"
}
That just copies the generated jar files into the folder where intellj expects them to be. My question is if there is a better way to tell Intellj IDEA where to find those files without copying them around?
Please sign in to leave a comment.
Please add the idea plugin to the gradle subproject:
plugins {
id 'idea'
}
idea {
module {
sourceDirs += file("${projectDir}/src/build/generated/source/main/java");
sourceDirs += file("${projectDir}/src/build/generated/source/main/grpc");
}
}