遇到了macOS grpc自动生成java代码问题
系统版本: macOS catalina 10.15
IDEA: 2019.1.3 社区版本
使用的protoc 的方式时,只能生成domain类,不能生成service类,需要使用protoc-gen-grpc-java的插件,各种需要自己编译,故使用https://github.com/grpc/grpc-java/blob/master/README.md描述的 Generated Code里面的方法。但是仍然无法生成grpc-java的代码,还是只有domain类,和使用widows系统同时比对,缺少如图1的标红的插件
继续看官方文档 发现如下描述(Eclipse and NetBeans users should also look at os-maven-plugin's IDE documentation进入链接https://github.com/trustin/os-maven-plugin#issues-with-eclipse-m2e-or-other-ides果断设置了maven的setting.xml。
另外注意需要执行两次 maven:protobuf:compile
<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>