遇到了macOS grpc自動生成java代碼問題
系統(tǒng)版本: macOS catalina 10.15
IDEA: 2019.1.3 社區(qū)版本
使用的protoc 的方式時,只能生成domain類,不能生成service類,需要使用protoc-gen-grpc-java的插件,各種需要自己編譯,故使用https://github.com/grpc/grpc-java/blob/master/README.md描述的 Generated Code里面的方法。但是仍然無法生成grpc-java的代碼,還是只有domain類,和使用widows系統(tǒng)同時比對,缺少如圖1的標(biāo)紅的插件

image
繼續(xù)看官方文檔 發(fā)現(xiàn)如下描述(Eclipse and NetBeans users should also look at os-maven-plugin's IDE documentation進(jìn)入鏈接https://github.com/trustin/os-maven-plugin#issues-with-eclipse-m2e-or-other-ides果斷設(shè)置了maven的setting.xml。
另外注意需要執(zhí)行兩次 maven:protobuf:compile

protobuf.compile.png
<profiles>
<profile>
<id>os-properties</id>
<properties>
<os.detected.name>osx</os.detected.name>
<os.detected.arch>x86_64</os.detected.arch>
<os.detected.classifier>osx-x86_64</os.detected.classifier>
</properties>
</profile>
<activeProfiles>
<activeProfile>apus nexus</activeProfile>
<activeProfile>os-properties</activeProfile>
</activeProfiles>