我需要导入我们中心maven中jar中定义的.proto文件。
这是我的build.gralde:
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
maven {
url 'http://abc.def.com/content/groups/public/'
}
maven {
url 'http://abc.def.com/content/repositories/snapshot/'
}
}
dependencies {
classpath 'def.abc.someObj:someObj-proto:1.2'
}
}
protobuf {
generatedFilesBaseDir="$projectDir/src/"
}
sourceSets {
main {
// this tells the plugin where your project specific
// protofiles are located
proto {
srcDir 'src/main/resources/proto/'
}
java {
srcDir 'src/main/java'
}
}
}
这是我的other.proto档案:
syntax = "proto3";
option java_multiple_files = true;
option java_package = "com.def.abc";
import "google/protobuf/any.proto";
import "someObj.proto";
每当我尝试编译时,它总是抱怨
Import "someObj.proto" was not found or had errors.
我已经从这个maven下载了jar文件,并且清楚地看到这个someObj.proto就在那里。
有什么想法吗?
谢谢!