Issues finding com.fasterxml.jackson.core in IntelliJ Idea
Asked Answered
S

1

9

I pulled down an 2 years old project and I'm having trouble building the project. I'm getting the following errors:

Error:(57, 29) java: cannot access com.fasterxml.jackson.core.Versioned
  class file for com.fasterxml.jackson.core.Versioned not found

and

Error:(58, 29) java: cannot access com.fasterxml.jackson.core.ObjectCodec
  class file for com.fasterxml.jackson.core.ObjectCodec not found

This is what I have for dependencies in pom.xml:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.2.2</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-guava</artifactId>
    <version>2.1.1</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-joda</artifactId>
    <version>2.1.1</version>
</dependency>

This is where the issue appears to be happening:

@Bean
public ObjectMapper objectMapper() {
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new GuavaModule());
    objectMapper.registerModule(new JodaModule());
    return objectMapper;
}

I've looked around and tried different versions with no luck.
Am I doing this wrong?

This worked once upon a time. Any help would be appreciated.

Surplus answered 6/11, 2015 at 20:2 Comment(5)
Can't reproduce. Try to remove your m2 repo and redownload everything from scratch.Loisloise
I'm assuming that repo is in a pom file somewhere? Also I'm using maven3 not sure if that would cause the issue? ThanksSurplus
Your m2 repo is where Maven stores every installed dependencies. It is typically located in ~/m2/repository. What I was suggesting is to delete this whole repository directory and relaunch Maven with mvn clean install. It will redownload every dependency and install them again, making sure there is no corruption somewhere.Loisloise
Ok now when I do mvn clean install i get "package org.apache.commons.codec.binary does not exist" from the command line and the 2 errors above only come up in itellij IDEA. Do you think those are related?Surplus
Build success on command line. Errors still showing up in IDEA.Surplus
B
-1

Best way is to use: http://mvnrepository.com/

Find there and enjoy!

Bisset answered 24/12, 2016 at 7:22 Comment(1)
Yes i added a dependency in pom.xml from this repository and that solved the issue for me . I observed that without this repository it had downloaded a older jarAbort

© 2022 - 2024 — McMap. All rights reserved.