1

我想将 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:\Users\christos\.sbt\1.0\plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from C:\Users\christos\cryptolotto\project
[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:\Users\christos\.ivy2\local\org.ethereum\solcJ-all\0.4.8\ivys\ivy.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:\Users\christos\.sbt\preloaded\org.ethereum\solcJ-all\0.4.8\ivys\ivy.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]
4

3 回答 3

2

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

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

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

于 2018-04-07T08:33:09.340 回答
0

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

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

这样做是完全错误的。

于 2018-04-07T09:13:44.090 回答
0

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

libraryDependencies += "org.web3j" % "core" % "3.3.1"
于 2018-04-15T15:06:13.163 回答