How to generate grpc java file in vscode using maven?
Solution 1:
Use protoc-jar-maven-plugin
instead .
<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>
<protocArtifact>com.google.protobuf:protoc:3.17.3</protocArtifact>
<inputDirectories>
<include>src/main/proto</include>
</inputDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
<outputDirectory>src/main/java</outputDirectory>
</outputTarget>
<outputTarget>
<type>grpc-java</type>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.39.0</pluginArtifact>
<outputDirectory>src/main/java</outputDirectory>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin>
Update 20220112
Adding this to maven setting file also works:
<profiles>
<profile>
<id>os-properties</id>
<properties>
<os.detected.name>linux</os.detected.name>
<os.detected.arch>x86_64</os.detected.arch>
<os.detected.classifier>linux-x86_64</os.detected.classifier>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>os-properties</activeProfile>
</activeProfiles>