我正在尝试使用 gRPC 为 Google Actions 上的智能家居模块实现报告状态。但是我不能为我的 *.proto 文件进行所有导入(如官方文档所述):https
://developers.google.com/actions/smarthome/report-state
我做错了什么?
我的原型文件:
syntax = "proto3";
package google.home.graph.v1;
import "google/home/graph/v1/device.proto"; // --> file not found
...
构建.gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
}
}
group 'pro.company'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'com.google.protobuf'
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.5.1-1"
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.12.0'
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
jar {
baseName = 'test'
version = ''
}
springBoot {
mainClass = "pro.foreway.Application"
executable = true
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'io.grpc:grpc-netty:1.12.0'
compile 'io.grpc:grpc-protobuf:1.12.0'
compile 'io.grpc:grpc-stub:1.12.0'
compile 'com.google.api.grpc:googleapis-common-protos:0.0.3'
}