How to import FromString for joda-time?

谁都会走 提交于 2019-12-06 21:06:24

问题


I try to use joda-time library for easier measuring the execution time of my program (not for profiling, just for the user).

But when I compile my project I get error about missing dependency -- the "FromString" class is missing. I tried to explicitly import it, but while typing intellisense (IntelliJ) does not even detect it, on the other hand there is only one jar for download from joda-time site.

How do I resolve this dependency?

I am aware of wrapper for JT but for now I would like to use it directly.


回答1:


If the problem is with FromString, then the missing dependency is Joda Convert. Add the relevant jars.




回答2:


This problem occurs because Scala doesn't implement annotations in the same way as Java. In Java, an annotation that is not found in the classpath is effectively ignored. Thus, loading Joda-Time classes in Java does NOT require Joda-Convert. Since Scala does not load annotations in the same way as Java, Scala users are forced to add the dependency.



来源:https://stackoverflow.com/questions/8368529/how-to-import-fromstring-for-joda-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!