我是 Hyperledger Fabric 的新手。當(dāng)我從 cli 容器安裝到對(duì)等點(diǎn)后實(shí)例化用 java 編寫的鏈代碼時(shí),出現(xiàn)了一些問(wèn)題: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我認(rèn)為這可能是 Maven 存儲(chǔ)庫(kù)的問(wèn)題,但是當(dāng)我在主機(jī)的終端中使用 gradle 時(shí),它運(yùn)行正常,如下所示: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'}有什么辦法可以解決這個(gè)問(wèn)題嗎?在主機(jī)和容器中運(yùn)行 gradle build 有什么區(qū)別?
2 回答

大話西游666
TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
實(shí)際上,你應(yīng)該使用
repositories { mavenLocal() mavenCentral() maven { maven { url 'https://jitpack.io' } } }
回購(gòu)而不是其他答案的回購(gòu),因?yàn)楣俜?code>json-schema文檔中建議使用此回購(gòu)。
引用:
將 JitPack 存儲(chǔ)庫(kù)和依賴項(xiàng)添加到您的 pom.xml 中,如下所示:
(參見: https: //github.com/everit-org/json-schema)

喵喔喔
TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超5個(gè)贊
我搜索了maven存儲(chǔ)庫(kù),發(fā)現(xiàn)這個(gè)依賴不在maven中央存儲(chǔ)庫(kù)中。在build.gradle中添加repository后如下:
repositories?{ ????mavenLocal() ????mavenCentral() ????maven?{ ????????url?"https://repository.mulesoft.org/nexus/content/repositories/public/" ????} }
它現(xiàn)在運(yùn)作良好。由于我不熟悉 gradle,我仍然想知道為什么我可以在主機(jī)中成功構(gòu)建而在 cli 容器中失?。?/p>
添加回答
舉報(bào)
0/150
提交
取消