我尝试编译Java链代码。
我收到以下错误。 请让我知道如何解决这个问题。
Could not resolve all dependencies for configuration ':examples:chaincode:java:Example:compileClasspath'.
Could not find org.hyperledger:shim-client:1.0.
Searched in the following locations:
file:/C:/Users/IBM_ADMIN/.m2/repository/org/hyperledger/shim-client/1.0/shim-client-1.0.pom
file:/C:/Users/IBM_ADMIN/.m2/repository/org/hyperledger/shim-client/1.0/shim-client-1.0.jar
https://repo1.maven.org/maven2/org/hyperledger/shim-client/1.0/shim-client-1.0.pom
https://repo1.maven.org/maven2/org/hyperledger/shim-client/1.0/shim-client-1.0.jar
Required by:
fabric.examples.chaincode.java:Example:unspecified***
答案 0 :(得分:5)
请切换到以下目录
github.com/hyperledger/fabric/core/chaincode/shim/java
并使用gradle build
构建,您应该看到以下输出
:core:chaincode:shim:java:copyProtos
:core:chaincode:shim:java:extractIncludeProto
Download https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.0.0-beta-2/protobuf-java-3.0.0-beta-2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-all/0.13.2/grpc-all-0.13.2.jar
Download https://repo1.maven.org/maven2/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-netty/0.13.2/grpc-netty-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-auth/0.13.2/grpc-auth-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-protobuf-nano/0.13.2/grpc-protobuf-nano-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-core/0.13.2/grpc-core-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-protobuf/0.13.2/grpc-protobuf-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-okhttp/0.13.2/grpc-okhttp-0.13.2.jar
Download https://repo1.maven.org/maven2/io/grpc/grpc-stub/0.13.2/grpc-stub-0.13.2.jar
Download https://repo1.maven.org/maven2/io/netty/netty-codec-http2/4.1.0.CR3/netty-codec-http2-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/com/google/auth/google-auth-library-oauth2-http/0.3.0/google-auth-library-oauth2-http-0.3.0.jar
Download https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0.jar
Download https://repo1.maven.org/maven2/com/google/protobuf/nano/protobuf-javanano/3.0.0-alpha-5/protobuf-javanano-3.0.0-alpha-5.jar
Download https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar
Download https://repo1.maven.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar
Download https://repo1.maven.org/maven2/com/squareup/okhttp/okhttp/2.5.0/okhttp-2.5.0.jar
Download https://repo1.maven.org/maven2/io/netty/netty-codec-http/4.1.0.CR3/netty-codec-http-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/io/netty/netty-handler/4.1.0.CR3/netty-handler-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/com/google/auth/google-auth-library-credentials/0.3.0/google-auth-library-credentials-0.3.0.jar
Download https://repo1.maven.org/maven2/com/google/http-client/google-http-client/1.19.0/google-http-client-1.19.0.jar
Download https://repo1.maven.org/maven2/com/google/http-client/google-http-client-jackson2/1.19.0/google-http-client-jackson2-1.19.0.jar
Download https://repo1.maven.org/maven2/io/netty/netty-codec/4.1.0.CR3/netty-codec-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/io/netty/netty-buffer/4.1.0.CR3/netty-buffer-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/io/netty/netty-transport/4.1.0.CR3/netty-transport-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.1.3/jackson-core-2.1.3.jar
Download https://repo1.maven.org/maven2/io/netty/netty-common/4.1.0.CR3/netty-common-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/io/netty/netty-resolver/4.1.0.CR3/netty-resolver-4.1.0.CR3.jar
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
:core:chaincode:shim:java:extractProto
:core:chaincode:shim:java:generateProto
:core:chaincode:shim:java:compileJava
Note: /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/java/src/main/java/org/hyperledger/java/shim/ChaincodeStub.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:core:chaincode:shim:java:processResources
:core:chaincode:shim:java:classes
:core:chaincode:shim:java:jar
:core:chaincode:shim:java:assemble
:core:chaincode:shim:java:extractIncludeTestProto
:core:chaincode:shim:java:extractTestProto
:core:chaincode:shim:java:generateTestProto UP-TO-DATE
:core:chaincode:shim:java:compileTestJava UP-TO-DATE
:core:chaincode:shim:java:processTestResources UP-TO-DATE
:core:chaincode:shim:java:testClasses UP-TO-DATE
:core:chaincode:shim:java:test UP-TO-DATE
:core:chaincode:shim:java:check UP-TO-DATE
:core:chaincode:shim:java:build
:core:chaincode:shim:java:copyToLib
:core:chaincode:shim:java:generatePomFileForMavenJavaPublication
:core:chaincode:shim:java:publishMavenJavaPublicationToMavenLocal
:core:chaincode:shim:java:publishToMavenLocal
BUILD SUCCESSFUL
Total time: 42.466 secs
完成后,切换回示例java代码目录并尝试通过gradle -b build.gradle build
它会很好,然后
:examples:chaincode:java:SimpleSample:compileJava
:examples:chaincode:java:SimpleSample:processResources UP-TO-DATE
:examples:chaincode:java:SimpleSample:classes
:examples:chaincode:java:SimpleSample:jar
:examples:chaincode:java:SimpleSample:startScripts
:examples:chaincode:java:SimpleSample:distTar
:examples:chaincode:java:SimpleSample:distZip
:examples:chaincode:java:SimpleSample:assemble
:examples:chaincode:java:SimpleSample:compileTestJava UP-TO-DATE
:examples:chaincode:java:SimpleSample:processTestResources UP-TO-DATE
:examples:chaincode:java:SimpleSample:testClasses UP-TO-DATE
:examples:chaincode:java:SimpleSample:test UP-TO-DATE
:examples:chaincode:java:SimpleSample:check UP-TO-DATE
:examples:chaincode:java:SimpleSample:build
:examples:chaincode:java:SimpleSample:copyToLib
BUILD SUCCESSFUL
Total time: 8.43 secs