我是 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 buildTask :compileJavaNote: /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.8repositories { mavenLocal() mavenCentral()}dependencies { compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.+' testCompile group: 'junit', name: 'junit', version: '4.12'}有什么办法可以解决这个问题吗?在主机和容器中运行 gradle build 有什么区别?
2 回答
大话西游666
TA贡献1817条经验 获得超14个赞
实际上,你应该使用
repositories { mavenLocal() mavenCentral() maven { maven { url 'https://jitpack.io' } } }
回购而不是其他答案的回购,因为官方json-schema
文档中建议使用此回购。
引用:
将 JitPack 存储库和依赖项添加到您的 pom.xml 中,如下所示:
(参见: https: //github.com/everit-org/json-schema)
喵喔喔
TA贡献1735条经验 获得超5个赞
我搜索了maven存储库,发现这个依赖不在maven中央存储库中。在build.gradle中添加repository后如下:
repositories { mavenLocal() mavenCentral() maven { url "https://repository.mulesoft.org/nexus/content/repositories/public/" } }
它现在运作良好。由于我不熟悉 gradle,我仍然想知道为什么我可以在主机中成功构建而在 cli 容器中失败?
添加回答
举报
0/150
提交
取消