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.

Ola Ström
  • 4,136
  • 5
  • 22
  • 41
D25
  • 159
  • 1
  • 1
  • 4
  • Can't reproduce. Try to remove your m2 repo and redownload everything from scratch. – Tunaki Nov 06 '15 at 20:06
  • I'm assuming that repo is in a pom file somewhere? Also I'm using maven3 not sure if that would cause the issue? Thanks – D25 Nov 06 '15 at 20:10
  • 2
    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. – Tunaki Nov 06 '15 at 20:15
  • 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? – D25 Nov 06 '15 at 20:22
  • 1
    Build success on command line. Errors still showing up in IDEA. – D25 Nov 06 '15 at 20:28

1 Answers1

-1

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

Find there and enjoy!

Sequoya
  • 433
  • 4
  • 16
  • 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 jar – Mohammed Rafeeq Oct 13 '17 at 15:00