我是 Hyperledger Fabric 的新手。当我在 cli 容器的对等点上安装后实例化用 java 编写的链代码时,出现了问题:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not find com.github.everit-org.json-schema:org.everit.json.schema:1.11.1.
Searched in the following locations:
file:/root/.m2/repository/com/github/everit-org/json-schema/org.everit.json.schema/1.11.1/org.everit.json.schema-1.11.1.pom
file:/root/.m2/repository/com/github/everit-org/json-schema/org.everit.json.schema/1.11.1/org.everit.json.schema-1.11.1.jar
https://repo.maven.apache.org/maven2/com/github/everit-org/json-schema/org.everit.json.schema/1.11.1/org.everit.json.schema-1.11.1.pom
https://repo.maven.apache.org/maven2/com/github/everit-org/json-schema/org.everit.json.schema/1.11.1/org.everit.json.schema-1.11.1.jar
Required by:
project : > org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.2
我认为这可能是 maven 存储库的问题,但是当我在主机的终端中使用 gradle 时,它运行正常,如下所示:
fabric@ubuntu:~/fabric1.4/fabric-samples/chaincode/master-liuqi/java$ sudo /opt/gradle/bin/gradle -b build.gradle build
Task :compileJava
Note: /home/fabric/fabric1.4/fabric-samples/chaincode/master-liuqi/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
BUILD SUCCESSFUL in 0s
2 actionable tasks: 2 executed
下面是我的 build.gradle,和 hyperleger 的示例链码一样。
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.3'
id 'java'
}
group 'org.hyperledger.fabric-chaincode-java'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.+'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
shadowJar {
baseName = 'chaincode'
version = null
classifier = null
manifest {
attributes 'Main-Class': 'org.hyperledger.fabric.example.SimpleChaincode'
}
}
有没有办法解决这个问题?在主机和容器中运行 gradle build 有什么区别?