1

I want to load web3j to an sbt project running in Intellj IDE and based on play framework. I tried to add

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

in build.sbt but I got errors. Any ideas?

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]
chatzich
  • 1,083
  • 2
  • 11
  • 26
  • You probably need to include the errors for someone to understand what the problem is (I'm not familiar enough with sbt and play to really help). – Pablo Fernandez Apr 06 '18 at 23:36
  • You're missing the repository. Check https://mvnrepository.com/artifact/org.ethereum/solcJ-all/0.5.7, there is a note stating that it's located at "https://dl.bintray.com/ethereum/maven/" – Marc Simon Sep 05 '19 at 00:06

3 Answers3

2

First of all, please update the question with the specific error you're getting.

What the issue could be is the usage of "%%" between the group id and artifactId. It only makes sense for scala dependencies to append the version of scala of your project to the artifact id of the dependency. Since web3j is written in Java, not scala, it doesn't make sense here. Try with the single "%".

EDIT: thanks for updating the question. Indeed sbt is looking for an artifact called web3j-maven-plugin_2.12, because it appended the scala version of your project to the artifact id.

Michal Borowiecki
  • 4,244
  • 1
  • 11
  • 18
  • I tried to use a single '%' but I took the same error :( – chatzich Apr 07 '18 at 09:19
  • When you do "org.web3j" % "web3j-maven-plugin" % "0.1.2" it should not be saying "org.web3j#web3j-maven-plugin_2.12;0.1.2: not found" any more because it won't add _2.12 to web3j-maven-plugin. Are you sure the error is exactly the same? – Michal Borowiecki Apr 07 '18 at 09:27
  • You are right my friend the error has changed! UNRESOLVED DEPENDENCIES org.ethereum#solcJ-all;0.4.8: not found – chatzich Apr 07 '18 at 09:32
0

I didn't post the error because I thought that adding

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

was totally wrong way to do this.

chatzich
  • 1,083
  • 2
  • 11
  • 26
0

I finally manage to solve the it and add web3j to build.sbt by adding the line:

libraryDependencies += "org.web3j" % "core" % "3.3.1"
chatzich
  • 1,083
  • 2
  • 11
  • 26