将 proto 文件转成 java 类:
将 proto 文件放在 /resource 目录下,执行 mvn package ,类会自动生成
<plugin> <groupId>com.github.os72</groupId> <artifactId>protoc-jar-maven-plugin</artifactId> <version>3.11.4</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>run</goal> </goals> <configuration> <protocVersion>${protobuf.version}</protocVersion> <protocArtifact>com.google.protobuf:protoc:3.14.0:exe:osx-x86_64</protocArtifact> <inputDirectories> <include>src/main/resources/proto</include> </inputDirectories> <outputTargets> <outputTarget> <type>java</type> <outputDirectory>src/main/java</outputDirectory> </outputTarget> </outputTargets> </configuration> </execution> </executions> </plugin>
标签:文件,protoc,java,protobuf,proto,main From: https://www.cnblogs.com/kevin-yuan/p/18278214