1
我無法建立的pom.xml,在鏈接下面提供GRPC-Java示例: https://github.com/grpc/grpc-javaGRPC的Java未能執行目標org.apache.maven.plugins:Maven的編譯器插件:3.1
它給我以下錯誤。
[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如下:
<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,所有0.9.0版本明確地建立它。