1

I am trying to understand gRPC. This is my pom file.

 <dependencies> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>3.9.1</version> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-netty-shaded</artifactId> <version>1.22.1</version> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-protobuf</artifactId> <version>1.22.1</version> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-stub</artifactId> <version>1.22.1</version> </dependency> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency> </dependencies> <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.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.xolstice.maven.plugins</groupId> <artifactId>protobuf-maven-plugin</artifactId> <version>0.5.1</version> <configuration> <protocArtifact> com.google.protobuf:protoc:3.0.0-beta-2:exe:${os.detected.classifier} </protocArtifact> <pluginId>grpc-java</pluginId> <pluginArtifact> io.grpc:protoc-gen-grpc-java:0.14.0:exe:${os.detected.classifier} </pluginArtifact> <protoSourceRoot> ${basedir}/src/main/proto </protoSourceRoot> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>compile-custom</goal> </goals> </execution> </executions> </plugin> </plugins> </build> 

I always keep getting a compilation error saying annotation @io.grpc.ExperimentalApi is missing a default value for the element 'value'.

The source is generated like this.

 public static interface DummyService { } @io.grpc.ExperimentalApi public static abstract class AbstractDummyService implements DummyService, io.grpc.BindableService { @java.lang.Override public io.grpc.ServerServiceDefinition bindService() { return DummyServiceGrpc.bindService(this); } } 

How to fix this?

1 Answer 1

3

The protobuf-maven-plugin is configured to use io.grpc:protoc-gen-grpc-java:0.14.0:exe:${os.detected.classifier}. 0.14.0 is ancient and pre-1.0. I suggest using the same version of protoc-gen-grpc-java as you do for the other io.grpc dependencies, which in this case is 1.22.1.

So you should change the pluginArtifact section to:

<pluginArtifact> io.grpc:protoc-gen-grpc-java:1.22.1:exe:${os.detected.classifier} </pluginArtifact> 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! Link to plugin docs: xolstice.org/protobuf-maven-plugin/examples/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.