If I follow the instruction in the grpc-java readme and I use maven, the protobuf generated files appear in the target directory and are subsequently in the classpath for me to extend etc. However, when I use gradle, the generated classes appear in the build directory and are absent from the classpath. I'm fairly new to gradle so I'm not really sure why it's behaving so differently.
My build.gradle file
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
}
}
group 'co.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile 'io.grpc:grpc-netty-shaded:1.15.1'
compile 'io.grpc:grpc-protobuf:1.15.1'
compile 'io.grpc:grpc-stub:1.15.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.5.1-1"
}
//noinspection GroovyAssignabilityCheck
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.15.1'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}