首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Grpc-java无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1

Grpc-java无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1
EN

Stack Overflow用户
提问于 2015-09-22 12:19:22
回答 1查看 1.4K关注 0票数 1

我无法为下面的链接中提供的grpc-java示例构建pom.xml:https://github.com/grpc/grpc-java

它给出了下面的错误。

代码语言:javascript
复制
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: linux
[INFO] os.detected.arch: x86_64
[INFO] os.detected.release: ubuntu
[INFO] os.detected.release.version: 14.04
[INFO] os.detected.release.like.ubuntu: true
[INFO] os.detected.release.like.debian: true
[INFO] os.detected.classifier: linux-x86_64
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-protoc-plugin:0.4.3:compile (default) @ helloworld ---
[INFO] Compiling 1 proto file(s) to /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/java
[INFO] 
[INFO] --- maven-protoc-plugin:0.4.3:compile-custom (default) @ helloworld ---
[WARNING] Missing POM for io.grpc:protoc-gen-grpc-java:exe:linux-x86_64:0.8.0
[INFO] Compiling 1 proto file(s) to /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pradnya/workspace/helloworld/src/main/resources
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/pradnya/workspace/helloworld/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[24,38] method marshaller in class io.grpc.protobuf.ProtoUtils cannot be applied to given types;
  required: T
  found: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloRequest>
  reason: inferred type does not conform to declared bound(s)
    inferred: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloRequest>
    bound(s): com.google.protobuf.MessageLite
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[25,38] method marshaller in class io.grpc.protobuf.ProtoUtils cannot be applied to given types;
  required: T
  found: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloResponse>
  reason: inferred type does not conform to declared bound(s)
    inferred: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloResponse>
    bound(s): com.google.protobuf.MessageLite
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[79,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[79,11] channel has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[103,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[103,11] channel has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[128,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[128,11] channel has private access in io.grpc.stub.AbstractStub
[INFO] 8 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.203 s
[INFO] Finished at: 2015-09-22T09:25:43+05:30
[INFO] Final Memory: 17M/59M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project helloworld: Compilation failure: Compilation failure:
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[24,38] method marshaller in class io.grpc.protobuf.ProtoUtils cannot be applied to given types;
[ERROR] required: T
[ERROR] found: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloRequest>
[ERROR] reason: inferred type does not conform to declared bound(s)
[ERROR] inferred: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloRequest>
[ERROR] bound(s): com.google.protobuf.MessageLite
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[25,38] method marshaller in class io.grpc.protobuf.ProtoUtils cannot be applied to given types;
[ERROR] required: T
[ERROR] found: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloResponse>
[ERROR] reason: inferred type does not conform to declared bound(s)
[ERROR] inferred: com.google.protobuf.Parser<io.grpc.examples.helloworld.HelloResponse>
[ERROR] bound(s): com.google.protobuf.MessageLite
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[79,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[79,11] channel has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[103,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[103,11] channel has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[128,45] callOptions has private access in io.grpc.stub.AbstractStub
[ERROR] /home/pradnya/workspace/helloworld/target/generated-sources/protobuf/grpc-java/io/grpc/examples/helloworld/GreeterGrpc.java:[128,11] channel has private access in io.grpc.stub.AbstractStub
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我的pom.xml如下:

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>io.grpc.examples</groupId>
  <artifactId>helloworld</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>helloworld</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
<dependency>
    <groupId>com.datastax.cassandra</groupId>
    <artifactId>cassandra-driver-core</artifactId>
    <version>2.1.7.1</version>
</dependency>
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-all</artifactId>
    <version>0.9.0</version>
</dependency>
  </dependencies>


  <pluginRepositories>
  <pluginRepository>
    <releases>
      <updatePolicy>never</updatePolicy>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>Central Repository</name>
    <url>https://repo.maven.apache.org/maven2</url>
  </pluginRepository>
  <pluginRepository>
    <id>protoc-plugin</id>
    <url>https://dl.bintray.com/sergei-ivanov/maven/</url>
  </pluginRepository>
</pluginRepositories>
<build>
  <extensions>
    <extension>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.4.0.Final</version>
    </extension>
  </extensions>
  <plugins>
    <plugin>
      <groupId>com.google.protobuf.tools</groupId>
      <artifactId>maven-protoc-plugin</artifactId>
      <version>0.4.3</version>
      <configuration>
        <!--
          The version of protoc must match protobuf-java. If you don't depend on
          protobuf-java directly, you will be transitively depending on the
          protobuf-java version that grpc depends on.
        -->
        <protocArtifact>com.google.protobuf:protoc:3.0.0-beta-1:exe:${os.detected.classifier}</protocArtifact>
        <pluginId>grpc-java</pluginId>
        <pluginArtifact>io.grpc:protoc-gen-grpc-java:0.8.0:exe:${os.detected.classifier}</pluginArtifact>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>compile</goal>
            <goal>compile-custom</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
</project>

我想显式地使用grpc-all 0.9.0版本构建它。

EN

回答 1

Stack Overflow用户

发布于 2016-01-16 07:43:42

我认为问题出在使用0.8.0 gRPC代码生成器:

代码语言:javascript
复制
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:0.8.0:exe:${os.detected.classifier}</pluginArtifact>

但是0.9.0库:

代码语言:javascript
复制
<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-all</artifactId>
    <version>0.9.0</version>
</dependency>

v0.8.0是gRPC不提供任何应用程序接口保证的最后一个版本。从v0.9.0开始,我们期望较旧的代码生成器与较新的gRPC运行时库兼容(尽管可能缺少功能/改进)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32708310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档