I'm trying to follow along this blog post, https://redbyte.eu/en/blog/calling-java-from-go-using-grpc/, with a working example for which my initial attempt is in this repository, https://github.com/khpeek/pdf-parser. The project has the following structure:
.
├── build
│?? ├── extracted-include-protos
│?? │?? └── main
│?? ├── extracted-protos
│?? │?? └── main
│?? └── tmp
│?? └── jar
│?? └── MANIFEST.MF
├── build.gradle
├── gradle
│?? └── wrapper
│?? ├── gradle-wrapper.jar
│?? └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
└── main
└── proto
└── pdfparserapi.proto
where the build.gradle
is as follows:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
}
}
plugins {
id "com.google.protobuf" version "0.8.14"
id "java"
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:4.0.0-rc-2'
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.14.0'
}
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
However, I if I run ./gradlew build
, I get the following error:
> ./gradlew build
> Task :generateProto FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateProto'.
> Could not resolve all files for configuration ':protobufToolsLocator_protoc'.
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
Required by:
project :
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
> Could not get resource 'https://artifacts.apple.com/libs-release/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> Could not GET 'https://artifacts.apple.com/libs-release/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> artifacts.apple.com
> Could not resolve com.google.protobuf:protoc:4.0.0-rc-2.
> Could not get resource 'https://artifacts.apple.com/libs-snapshot/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> Could not GET 'https://artifacts.apple.com/libs-snapshot/com/google/protobuf/protoc/4.0.0-rc-2/protoc-4.0.0-rc-2.pom'.
> artifacts.apple.com
* 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 908ms
3 actionable tasks: 3 executed
I'm not sure what causes this error because I can find that version of the dependency on Maven Central (https://search.maven.org/artifact/com.google.protobuf/protoc/4.0.0-rc-2/pom). Any idea how to resolve this issue?
(One thing that I observed that could be related is that the grpc
closure is grayed out and if I hover over it in IntelliJ, I see the message
No candidates found for method call grpc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…