Compilation error package com.fasterxml.jackson.annotation does not exist

25,487

use

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.11.0</version>
    </dependency>

This will bring in the two transitive dependencies:

Share:
25,487

Related videos on Youtube

Sandeepan Nath
Author by

Sandeepan Nath

Organizer of meetup group PHP Micro Meetups (Pune) About me I am a Software Developer/Designer from India. Here is my Brief Résumé on Stackoverflow Careers. Contact me at sandeepan (dot) nits (at) google's mail. Other than programming I have deep interests in Human Psychology, Entrepreneurship, Social work and Scientific Research. While younger I had deep interests in Genetics, Astronomy etc. I love computer games, especially FPS games on multi-player, cricket, music, racing and adventure. I am a 24 years old guy and as time is passing by, I am gradually coming to realize that there are so many things to see and do in this beautiful world. I am afraid that a few years down the line I will repent over so many things I wished to do but could not do. However, I have started serious planning for all this.

Updated on July 09, 2022

Comments

  • Sandeepan Nath
    Sandeepan Nath almost 2 years

    Following class is showing issue - The import com.fasterxml.jackson cannot be resolved -

    import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
    
    
    @JsonIgnoreProperties(ignoreUnknown=true)
    public class MerchantDetailsDto {
    

    Compilation error on running clean install -

    [ERROR] COMPILATION ERROR : 
    
    [INFO] -------------------------------------------------------------
    
    [ERROR] /Path/to/src/main/java/com/citruspay/common/dto/merchant/MerchantDetailsDto.java:[9,40] package com.fasterxml.jackson.annotation does not exist
    
    [ERROR] /Path/to/src/main/java/com/citruspay/common/dto/merchant/MerchantDetailsDto.java:[11,2] cannot find symbol
    
      symbol: class JsonIgnoreProperties
    

    The pom definition is this, which is in the pom of a project which is defined as dependency of the current project -

    <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson-core.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson-core.version}</version>
            </dependency>
    

    And

    <jackson-core.version>2.6.1</jackson-core.version>
    

    I checked the maven repository for this component, and it seems it does not have any dependency.

    I tried changing the version to latest - 2.10.0.pr1 and tried doing maven update of the dependency project but could not find the jar downloaded inside .m2. There are two paths where the directory structure corresponding to this component is there -

    .m2/fasterxml/jackson/core/jackson-annotations

    .m2/repository/com/fasterxml/jackson/core/jackson-annotations

    I am not sure which of these is the actual one, so I tried deleting the existing version directory from both of these, but even the same version jar did not get downloaded when I tried maven update and clean install.

    Would appreciate any pointers.

    Update

    Output of clean install command on dependency project -

    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ------< com.project.path.to.project-dependency >------
    [INFO] Building project-dependency 1.0-SNAPSHOT
    [INFO] --------------------------------[ pom ]---------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ project-dependency ---
    [INFO] 
    [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ citruspay-spring-dependencies ---
    [INFO] Installing /Path/to/dependency/project/pom.xml to /path to/.m2/repository/com/project/path/to/dependency/1.0-SNAPSHOT/project-dependency-1.0-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  0.417 s
    [INFO] Finished at: 2019-07-24T17:25:42+05:30
    [INFO] ------------------------------------------------------------------------
    

Related