1

I'm getting this error:

[warn] Class org.joda.convert.FromString not found - continuing with a stub.

But in build.sbt it's explicitly included:

libraryDependencies += "joda-time" %  "joda-time" % "2.9.6"
libraryDependencies += "org.joda" % "joda-convert" % "1.8.1"

and that seems to be the fix for most people having this issue, eg. Class broken error with Joda Time using Scala . Running dependency graph I see evictions:

[info]       +-joda-time:joda-time:2.3 (evicted by: 2.9.6)
[info]       +-joda-time:joda-time:2.8.2 (evicted by: 2.9.6)
[info]       +-joda-time:joda-time:2.9.6
[info]       +-org.joda:joda-convert:1.8.1
[info]       +-org.scala-lang.modules:scala-xml_2.11:1.0.5 [S]
[info]
[success] Total time: 10 s, completed May 11, 2017 6:38:09 PM

but it seems that in the end the latest versions win and looks like convert is included. Tests run fine and date conversions as well.

Right now, I'm at a bit of a loss.. How should I fix this / debug this in sbt?

Community
  • 1
  • 1
scc
  • 10,342
  • 10
  • 51
  • 65
  • 1
    can you downgrade the joda time version to 2.1 as `libraryDependencies += "joda-time" % "joda-time" % "2.1" libraryDependencies += "org.joda" % "joda-convert" % "1.8.1"` – Ramesh Maharjan May 11 '17 at 18:24
  • @RameshMaharjan Unfortunately it didn't work either.. – scc May 11 '17 at 18:39
  • @RameshMaharjan Well, no, it's still being overridden to 2.9.6 due to com.typesafe.play:play-json_2.11:2.6.0-M6. Gonna try a dependency override next – scc May 11 '17 at 18:44
  • 1) You already have joda from transitive dependencies so it could be used. The problem is 2 different potentially incompatible versions remains. 2) Exclude transitive dependencies. But this is some kind of mine bomb within libraries. 3) If it's possible use java 8 time package (imho the best way). – Zernike May 12 '17 at 06:41
  • Yeah, it's still not working, even forcing a dependency override for both joda and convert. I'll try the exclude transitive dependencies now.. @Zernike At this point, it's not really possible to replace joda in all project modules now. – scc May 12 '17 at 07:13
  • Yet another sad approach exists (I hate it because situation becomes worse). Separate code parts with joda deps as standalone modules and then shade joda in packages. – Zernike May 12 '17 at 07:31

1 Answers1

2

So, in my case it was simply a matter of excluding the transitive dependency. Something like this:

libraryDependencies += "org.com" %% "core" % "0.1-SNAPSHOT" exclude("org.joda", "joda-convert")
scc
  • 10,342
  • 10
  • 51
  • 65