I'm trying to get into the habit of using build tools. However, sbt is giving me some trouble, and I don't yet know enough about it to troubleshoot the cause of the problem.
I'm trying to add JotaTime as a dependency to my project.
My build.sbt
in full looks like this:
name := "MyProject"
libraryDependencies += "joda-time" % "joda-time" % "2.3"
Now, it seems to find the library and finish updating without issue. I can start using joda-time in my IDE. I can import the modules, autocomplete works, etc.. However, once I try to actually run the project I get these errors:
Error:scalac: error while loading LocalDateTime, class file 'C:\Users\myname\.ivy2\cache\joda-time\joda-time\jars\joda-time-2.3.jar(org/joda/time/LocalDateTime.class)' is broken
(class java.lang.RuntimeException/bad constant pool tag 10 at byte 42)
The exact code in question is this:
def main(args: List[String]) = {
println(new LocalDateTime(System.currentTimeMillis))
}
To try and troubleshoot this a bit. I removed the dependency line from the build.sbt
and instead downloaded and added the jota-time
library manually via my IDE (version 2.3, just as in the build file), and everything works A-OK. No errors. Everything compiles and runs.
What would be causing the version of JodaTime that sbt downloads to be broken?