Java 如何将web3j库加载到sbt项目?

Java 如何将web3j库加载到sbt项目?,java,intellij-idea,sbt,playframework-2.3,web3-java,Java,Intellij Idea,Sbt,Playframework 2.3,Web3 Java,我想将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 plugin

我想将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]

首先,请用您得到的具体错误更新问题

问题可能是在组id和artifactId之间使用了“%%”。它只适用于scala依赖项。因为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"

您可能需要包含错误,以便有人了解问题所在(我对sbt和play不太熟悉,无法真正提供帮助)。您缺少存储库。检查,有一个注释指出它位于“我试图使用单个“%”,但我犯了相同的错误:(当您使用“org.web3j”%”web3j-maven-plugin“%”“0.1.2”时,它不应该说“org.web3j#web3j-maven-plugin_2.12;0.1.2:未找到”更多,因为它不会将_2.12添加到web3j maven插件。你确定错误完全相同吗?你是对的,我的朋友,错误已更改!未解决的依赖项org.ethereum#solcJ all;0.4.8:未找到