Suppose a project is called A, consists of 4 modules, how to connect a library not to the whole project A, but, for example, only to 2 modules?

There is such code:

import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.StringWriter; public class Solution { public static void main(String[] args) throws IOException { Cat cat = new Cat(); cat.name = "Murka"; cat.age = 5; cat.weight = 3; StringWriter writer = new StringWriter(); convertToJSON(writer, cat); System.out.println(writer.toString()); } public static void convertToJSON(StringWriter writer, Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(writer, object); } @JsonAutoDetect public static class Cat { @JsonProperty("wildAnimal") public String name; @JsonIgnore public int age; @JsonProperty("over") public int weight; Cat() { } } } 

I run in intelliJ This error produces:

 Error:(4, 1) java: package com.fasterxml.jackson.core does not exist Error:(39, 15) java: cannot access com.fasterxml.jackson.core.Versioned class file for com.fasterxml.jackson.core.Versioned not found 

    1 answer 1

    The error occurred due to the fact that Jackson connected to the entire project, and not to a separate module of the project. Connecting to a separate module, you need to remember to remove the lib from the entire project, otherwise there is no effect. If anyone knows why this error may occur, please write the answer.