You are missing the protobuf-java
dependency.
<dependencies>
??? <dependency>
????? <groupId>com.google.protobuf</groupId>
????? <artifactId>protobuf-java</artifactId>
????? <version>3.5.1-1</version>
??? </dependency>
??? ...
? </dependencies>
Here is how I use the plugin.
<build>
? <extensions>
??? <extension>
????? <groupId>kr.motd.maven</groupId>
????? <artifactId>os-maven-plugin</artifactId>
????? <version>1.5.0.Final</version>
??? </extension>
? </extensions>
? <plugins>
??? <plugin>
????? <groupId>org.xolstice.maven.plugins</groupId>
????? <artifactId>protobuf-maven-plugin</artifactId>
????? <version>0.5.1</version>
????? <extensions>true</extensions>
????? <configuration>
??????? <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
????? </configuration>
????? <executions>
??????? <execution>
????????? <goals>
??????????? <goal>compile</goal>
??????????? <goal>test-compile</goal>
????????? </goals>
??????? </execution>
????? </executions>
??? </plugin>
? </plugins>
</build>
Then use the mvn protobuf:compile
to generate the stubs. The reference is from the plugin repo at https://github.com/xolstice/protobuf-maven-plugin
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…