首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用多模块maven项目时使用eclipse的类路径问题

使用多模块maven项目时使用eclipse的类路径问题
EN

Stack Overflow用户
提问于 2019-07-18 09:28:46
回答 1查看 854关注 0票数 0

我有一个带有相当多子模块的spring 2项目.

一些模块使用包含jackson-databind的库。我为他们添加了除外条款。在执行mvn dependency:tree | grep jackson-databind时,我没有2.2.2依赖项。使用mvn spring-boot:run可以完美地工作。但是,在eclipse中启动应用程序会导致下面的错误。

我应该在哪里寻找错误的来源?

代码语言:javascript
复制
***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.registerWellKnownModulesIfAvailable(Jackson2ObjectMapperBuilder.java:777)

The following method did not exist:

    com.fasterxml.jackson.databind.Module.getTypeId()Ljava/lang/Object;

The method's class, com.fasterxml.jackson.databind.Module, is available from the following locations:

    jar:file:/C:/Users/somebody/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.2.2/jackson-databind-2.2.2.jar!/com/fasterxml/jackson/databind/Module.class
    jar:file:/C:/Users/somebody/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.6.6/jackson-databind-2.6.6.jar!/com/fasterxml/jackson/databind/Module.class
    jar:file:/C:/Users/somebody/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar!/com/fasterxml/jackson/databind/Module.class
    jar:file:/C:/Users/somebody/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.8.8/jackson-databind-2.8.8.jar!/com/fasterxml/jackson/databind/Module.class

It was loaded from the following location:

    file:/C:/Users/somebody/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.2.2/jackson-databind-2.2.2.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of com.fasterxml.jackson.databind.Module
EN

回答 1

Stack Overflow用户

发布于 2019-07-18 10:04:15

嗯嗯。似乎这个项目被错误地导入了eclipse。也许是mvn eclipse:eclipse的错。

  • 从工作区中删除项目
  • 删除所有eclipse项目文件(.project.classpath等)
  • 把它们放进.gitignore
  • 通过import maven project导入项目

现在起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57091306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档