如何将 web3j 库加载到 sbt 项目



我想将web3j加载到在Intellj IDE中运行并基于play框架的sbt项目中。我试图添加

libraryDependencies += "org.web3j" % "web3j-maven-plugin" % "0.1.2"

build.sbt但我得到了错误。有什么想法吗?

Error while importing sbt project:
[info] Loading settings from idea.sbt ...
[info] Loading global plugins from C:Userschristos.sbt1.0plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from C:Userschristoscryptolottoproject
[info] Loading settings from build.sbt ...
[info] Set current project to cryptolotto (in build file:/C:/Users/christos/cryptolotto/)
[info] sbt server started at local:sbt-server-b84ab1850f860119aa36
[cryptolotto] $
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile, shellPrompt
[info] The new values will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to cryptolotto (in build file:/C:/Users/christos/cryptolotto/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from C:/Users/christos/.IdeaIC2017.3/config/plugins/Scala/launcher/sbt-structure-1.0.jar
[info] Reapplying settings...
[info] Set current project to cryptolotto (in build file:/C:/Users/christos/cryptolotto/)
[info] Updating ...
[warn]  module not found: org.ethereum#solcJ-all;0.4.8
[warn] ==== local: tried
[warn]   C:Userschristos.ivy2localorg.ethereumsolcJ-all.4.8ivysivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/ethereum/solcJ-all/0.4.8/solcJ-all-0.4.8.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   C:Userschristos.sbtpreloadedorg.ethereumsolcJ-all.4.8ivysivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:/C:/Users/christos/.sbt/preloaded/org/ethereum/solcJ-all/0.4.8/solcJ-all-0.4.8.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: org.ethereum#solcJ-all;0.4.8: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]

首先,请使用您遇到的特定错误更新问题。

问题可能是在组 ID 和工件 ID 之间使用"%%"。只有 scala 依赖项将项目的 scala 版本附加到依赖项的工件 id 才有意义。由于web3j是用Java而不是scala编写的,所以在这里没有意义。尝试使用单个"%"。

编辑:感谢您更新问题。事实上,sbt 正在寻找一个名为 web3j-maven-plugin_2.12 的工件,因为它将项目的 scala 版本附加到工件 ID 中。

我没有发布错误,因为我认为添加

libraryDependencies += "org.web3j" %% "web3j-maven-plugin" % "0.1.2"

这样做是完全错误的方法。

我终于设法解决了它,并通过添加以下行将 web3j 添加到 build.sbt 中:

libraryDependencies += "org.web3j" % "core" % "3.3.1"

相关内容

  • 没有找到相关文章

最新更新