Search code examples
springmavenjacksonjackson-modules

Imported Git Repository but some imports are not found?


I have a Git Repository that I imported into Eclipse but it has some import errors.

I'm using Spring Redis version 1.8.4 and following their examples on how to do object mapping. I used the Jackson Mapper link and then followed that to the jackson-datatype-mongo mapper.

https://github.com/commercehub-oss/jackson-datatype-mongo

On my work computer everything is fine.

enter image description here

<dependency>
        <groupId>com.commercehub.jackson</groupId>
        <artifactId>jackson-datatype-mongo</artifactId>
        <version>2.1.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.7.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
        <version>1.8.4.RELEASE</version>
    </dependency>

If I remove the jackson-datatype-mongo dependency then the imports are fine but then I wouldn't have the MongoModule import. I tried one of eclipse's solutions and it said that it could an archive 'jackson-databind-2.8.1.jar' and everything would be clear. But then my '.classpath' file is now changed.

I don't understand how it is fine on one machine and all I did was clone the repository into another machine.


Solution

  • I solved the issue. I checked libraries in the project and it showed that the class was in there. So I went into '.m2\repository\com\fasterxml\jackson\core' and deleted the whole 'jackson-databind' folder and restarted eclipse and all the imports were now resolved.