protobuf-maven-plugin编译失败
protobuf-maven-plugin编译失败
问题现象
[ERROR] PROTOC FAILED: ????????????????
[ERROR]xxxxxxx\message.proto [0:0]: ????????????????
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.937 s
[INFO] Finished at: 2020-09-07T19:55:20+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (default-cli) on project xxx: protoc did not exit cleanly. Review output for more information. -> [Help 1]
问题原因
Google后,也并未找到最终的原因,然后,多番尝试,怀疑是版本问题,如果遇到该问题,可以尝试按照下面的版本配置一下,观察是否恢复:
- maven : 3.6.3
- 其它内容版本:
<properties>
<protobuf.version>3.12.4</protobuf.version>
<plugin.protobuf.version>0.6.1</plugin.protobuf.version>
<grpc.version>1.6.1</grpc.version>
<plugin.os.version>1.6.2</plugin.os.version>
</properties>
下面是插件配置:
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>${plugin.os.version}</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${plugin.protobuf.version}</version>
<extensions>true</extensions>
<configuration>
<protoSourceRoot>${project.basedir}/src/main/proto</protoSourceRoot>
<clearOutputDirectory>false</clearOutputDirectory>
<protocArtifact>
com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>