java - Gradle 依赖声明(JSR310),但 LocalDateTimeDeserializer 不可导入

标签 java json eclipse gradle

场景是:

问题:我无法将 LocalDateTimeDeserializer 导入到我的代码中

这是我的 gradle 依赖项部分:

dependencies {
   compile ("org.springframework.social:spring-social-core:$springSocialVersion")
   compile ("org.springframework.social:spring-social-config:$springSocialVersion")
   compile ("org.springframework.social:spring-social-security:$springSocialVersion", optional)
   compile ("com.fasterxml.jackson.core:jackson-core:$jacksonVersion")
   compile ("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
   compile ("com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion")
   compile ("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jsr310Version")
   compile ("org.springframework.security:spring-security-crypto:$springSecurityCryptoVersion")
   compile ("javax.servlet:javax.servlet-api:$servletApiVersion", provided)
   testCompile ("org.springframework:spring-test:$springVersion")
}

我确信这是一个陷阱!它在哪里?

非常感谢您的帮助!

最佳答案

好的,解决了!

问题(显然)与类路径有关。 我是 Eclipse 开发的新手,所以我对它的工作原理每天都越来越清楚。

要解决类似问题,请执行以下操作:

  1. 将依赖项添加到您的 gradle 构建中 编译(“com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.5.1”)

  2. 您必须刷新类路径。使用 gradle,为此,运行 gradle cleanEclipse && gradle eclipse

  3. 刷新您的 eclipse 。在我的身上,我真的不得不重新启动它。

在此之后,它发挥了神奇作用:LocalDateTimeDeserializer 在那里供我导入。

注意:我不喜欢我自己的方法,并且我认为它太古怪而不正确,所以我会留下这个问题以防万一对这里发生的事情有更清楚的了解会得到更好的答案。

应该为那些像我一样继续前进的人提供引用。

关于java - Gradle 依赖声明(JSR310),但 LocalDateTimeDeserializer 不可导入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29448020/

相关文章:

java - 从 Spring JdbcTemplate 的 queryForObject 方法返回泛型类型

java - Jersey 客户端日志响应和 getEntity

javascript - jQuery post() JSP 返回集合

python - Eclipse 控制台中的 Pydev 源文件超链接

eclipse - 无法访问jsp文件上的图像

eclipse - Spring Web-用 WebApplicationInitializer 替换 web.xml 给我 404

java - Eclipse Oxygen/Neon 和 groovy - 这可能吗?

java - 如何替换java中的前几个字符?

java - MySQL 数据未显示在 Android RecyclerView 中(Logcat 错误 : Couldn't load memtrack module)

javascript - 可以通过浏览器访问远程 json 组件,但不能通过 $.getJSON() 以编程方式访问